summaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2021-04-12 08:52:32 +0900
committerMark Brown <broonie@kernel.org>2021-04-13 12:32:52 +0100
commit9830d3e99f51fc1c1c6ab8be7778fd205af198ad (patch)
treef8f310ff76cf3bece7d18631fa5f78085700ceeb /include/sound
parent40d8cbe70e71be170e0a4fe6ab112d9aaa9cfb18 (diff)
downloadlinux-9830d3e99f51fc1c1c6ab8be7778fd205af198ad.tar.bz2
ASoC: simple-card-utils: add simple_props_to_xxx() macro
We shouldn't use dai_props->cpus/codecs/cpu_dai/codec_dai/codec_conf directly, because these are array to supporting multi CPU/Codec/Platform. This patch adds asoc_link_to_xxx() macro for it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87k0p8wf9b.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/simple_card_utils.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
index e366e432c475..78b6cf0194d2 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -74,32 +74,45 @@ struct asoc_simple_priv {
#define simple_priv_to_dev(priv) (simple_priv_to_card(priv)->dev)
#define simple_priv_to_link(priv, i) (simple_priv_to_card(priv)->dai_link + (i))
+#define simple_props_to_dlc_cpu(props, i) ((props)->cpus + i)
+#define simple_props_to_dlc_codec(props, i) ((props)->codecs + i)
+#define simple_props_to_dlc_platform(props, i) ((props)->platforms + i)
+
+#define simple_props_to_dai_cpu(props, i) ((props)->cpu_dai + i)
+#define simple_props_to_dai_codec(props, i) ((props)->codec_dai + i)
+#define simple_props_to_codec_conf(props, i) ((props)->codec_conf + i)
+
#define for_each_prop_dlc_cpus(props, i, cpu) \
for ((i) = 0; \
- ((i) < (props)->num.cpus) && ((cpu) = &(props)->cpus[i]); \
+ ((i) < (props)->num.cpus) && \
+ ((cpu) = simple_props_to_dlc_cpu(props, i)); \
(i)++)
-#define for_each_prop_dlc_codecs(props, i, codec) \
+#define for_each_prop_dlc_codecs(props, i, codec) \
for ((i) = 0; \
- ((i) < (props)->num.codecs) && ((codec) = &(props)->codecs[i]); \
+ ((i) < (props)->num.codecs) && \
+ ((codec) = simple_props_to_dlc_codec(props, i)); \
(i)++)
#define for_each_prop_dlc_platforms(props, i, platform) \
for ((i) = 0; \
- ((i) < (props)->num.platforms) && ((platform) = &(props)->platforms[i]); \
+ ((i) < (props)->num.platforms) && \
+ ((platform) = simple_props_to_dlc_platform(props, i)); \
(i)++)
#define for_each_prop_codec_conf(props, i, conf) \
for ((i) = 0; \
((i) < (props)->num.codecs) && \
(props)->codec_conf && \
- ((conf) = &(props)->codec_conf[i]); \
+ ((conf) = simple_props_to_codec_conf(props, i)); \
(i)++)
#define for_each_prop_dai_cpu(props, i, cpu) \
for ((i) = 0; \
- ((i) < (props)->num.cpus) && ((cpu) = &(props)->cpu_dai[i]); \
+ ((i) < (props)->num.cpus) && \
+ ((cpu) = simple_props_to_dai_cpu(props, i)); \
(i)++)
#define for_each_prop_dai_codec(props, i, codec) \
for ((i) = 0; \
- ((i) < (props)->num.codecs) && ((codec) = &(props)->codec_dai[i]); \
+ ((i) < (props)->num.codecs) && \
+ ((codec) = simple_props_to_dai_codec(props, i)); \
(i)++)
struct link_info {