[alsa-devel] [PATCH 082/102] ASoC: Add SOC_ENUM_SINGLE_CONST() and SOC_ENUM_DOUBLE_CONST() macros
Takashi Iwai
tiwai at suse.de
Thu Feb 20 08:08:51 CET 2014
At Thu, 20 Feb 2014 11:33:39 +0900,
Mark Brown wrote:
>
> On Tue, Feb 18, 2014 at 12:51:28PM +0100, Takashi Iwai wrote:
> > Add new helper macros for defining the enum elements with a constant
> > array. With these macros, redundant ARRAY_SIZE() can be removed in
> > the code.
>
> So, this doesn't seem like the best way to do things. For one thing
> it's not really that the arrays are const, it's the fact that they are a
> fixed size that makes the difference with these macros. An array where
> we fill in a fixed number of strings at runtime would work just as well
> for this.
Hm, in theory, yes. I thought of _FIXED instead of _CONST, too, but
the former sounds also obscure, so I picked the latter in the end.
> I'd also expect this to be more what the default naming does
> since we want to try to steer people towards using the simplest and
> least error prone mechanism for doing this.
If changing the existing API is fine for you (not adding the new one),
it's trivial to convert the patches to do so. Looking at the end
result, all SOC_ENUM_SINGLE() and SOC_ENUM_DOUBLE() usages are
covered. For any specific usage in future, we may provide lowlevel
macros, __SOC_ENUM_SINGLE() with the number of items, too.
Takashi
More information about the Alsa-devel
mailing list