summaryrefslogtreecommitdiff
path: root/include/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2018-09-03 02:12:56 +0000
committerMark Brown <broonie@kernel.org>2018-09-04 16:59:11 +0100
commit0b7990e38971da403ce223d8bdc758a817eb72f8 (patch)
treeacaec9b0b94b9f7a8823b665cab92502eda84bd8 /include/sound
parent3db769f17714ae65f2faf44ff2bae9d52f4bd46b (diff)
ASoC: add for_each_rtd_codec_dai() macro
ALSA SoC snd_soc_pcm_runtime has snd_soc_dai array for codec_dai. To be more readable code, this patch adds new for_each_rtd_codec_dai() macro, and replace existing code to it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index ce42c578fe82..6b68b31e3140 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1158,6 +1158,13 @@ struct snd_soc_pcm_runtime {
unsigned int dev_registered:1;
unsigned int pop_wait:1;
};
+#define for_each_rtd_codec_dai(rtd, i, dai)\
+ for ((i) = 0; \
+ ((i) < rtd->num_codecs) && ((dai) = rtd->codec_dais[i]); \
+ (i)++)
+#define for_each_rtd_codec_dai_reverse(rtd, i, dai) \
+ for (; ((i--) >= 0) && ((dai) = rtd->codec_dais[i]);)
+
/* mixer control */
struct soc_mixer_control {