From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: HariKrishna Sagala <hariconscious@gmail.com>
Cc: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
tiwai@suse.com, shuah@kernel.org, david.hunter.linux@gmail.com,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] ASoC: soc-core: proposal to remove num_auto_selectable_formats from snd_soc_dai_ops
Date: Fri, 31 Oct 2025 06:58:24 +0000 [thread overview]
Message-ID: <87ldkr36cv.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <2daa603f-13fe-c803-17fc-4fdd8e5723ba@gmail.com>
Hi HariKrishna
Thank you for suggestion
> Iʼd like to propose a small cleanup and simplification in the
> snd_soc_dai_ops structure by removing the
> "num_auto_selectable_formats" parameter.
Do you mean like this ?
struct snd_soc_dai_ops {
...
const u64 *auto_selectable_formats;
- int num_auto_selectable_formats;
...
};
> Currently,snd_soc_dai_ops includes the "num_auto_selectable_formats"
> field to indicate the number of entries in the "auto_selectable_formats"
> array.However, this count can be derived programmatically using the
> ARRAY_SIZE() macro wherever needed.
If my understanding was correct, unfortunately we can't do it.
We can use ARRAY_SIZE() in each driver, because we can access to raw array.
But can't use it on ASoC framework, becase auto_selectable_formats is just
a pointer. see how ARRAY_SIZE() is defined.
--- driver ---
my_formats[] = {
[0] = SND_SOC_POSSIBLE_DAIFMT_xxx | SND_SOC_POSSIBLE_DAIFMT_xxx ...,
[1] = SND_SOC_POSSIBLE_DAIFMT_xxx | SND_SOC_POSSIBLE_DAIFMT_xxx ...,
};
// We can use ARRAY_SIZE() in driver, because we know raw array.
my_dai_ops = {
...
.auto_selectable_formats = my_formats,
=> .num_auto_selectable_formats = ARRAY_SIZE(my_formats),
};
--- soc-xxx.c ---
// it will be error, because we don't know its size
=> int num = ARRAY_SIZE(ops->auto_selectable_formats);
Or do you mean create new macro, like this ?
#define ASOC_SELECT_FORMATS(array)\
.auto_selectable_formats = array,
.num_auto_selectable_formats = ARRAY_SIZE(array)
my_ops = {
...
- .auto_selectable_formats = my_formats,
- .num_auto_selectable_formats = ARRAY_SIZE(my_formats),
+ ASOC_SELECT_FORMATS(my_formats),
};
Or am I misunderstanding your suggestion ?
Thank you for your help !!
Best regards
---
Kuninori Morimoto
next prev parent reply other threads:[~2025-10-31 6:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 4:56 HariKrishna Sagala
2025-10-31 6:58 ` Kuninori Morimoto [this message]
2025-10-31 14:15 ` harikrishna
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ldkr36cv.wl-kuninori.morimoto.gx@renesas.com \
--to=kuninori.morimoto.gx@renesas.com \
--cc=broonie@kernel.org \
--cc=david.hunter.linux@gmail.com \
--cc=hariconscious@gmail.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=shuah@kernel.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®