[alsa-devel] [PATCH 082/102] ASoC: Add SOC_ENUM_SINGLE_CONST() and SOC_ENUM_DOUBLE_CONST() macros
Takashi Iwai
tiwai at suse.de
Tue Feb 18 12:51:28 CET 2014
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.
Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
include/sound/soc.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index cc891387e7ac..11966c1cd33a 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -285,9 +285,13 @@
* Simplified versions of above macros, declaring a struct and calculating
* ARRAY_SIZE internally
*/
+#define SOC_ENUM_DOUBLE_CONST(xreg, xshift_l, xshift_r, xtexts) \
+ SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, ARRAY_SIZE(xtexts), xtexts)
+#define SOC_ENUM_SINGLE_CONST(xreg, xshift, xtexts) \
+ SOC_ENUM_DOUBLE_CONST(xreg, xshift, xshift, xtexts)
+
#define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \
- const struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \
- ARRAY_SIZE(xtexts), xtexts)
+ const struct soc_enum name = SOC_ENUM_DOUBLE_CONST(xreg, xshift_l, xshift_r, xtexts)
#define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \
SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts)
#define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \
--
1.8.5.2
More information about the Alsa-devel
mailing list