[alsa-devel] [PATCH v4 10/18] ALSA: pcm.h: add for_each_pcm_streams()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Mon Feb 17 09:28:19 CET 2020


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

ALSA code has SNDRV_PCM_STREAM_PLAYBACK/CAPTURE everywhere.
Having for_each_xxxx macro is useful.
This patch adds for_each_pcm_streams() for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
Acked-by: Takashi Iwai <tiwai at suse.de>
---
v3 -> v4

	- on Subject, ASoC  -> ALSA 
	- on Subject, soc.h -> pcm.h

 include/sound/pcm.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index f657ff08f317..2628246b76fa 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -644,6 +644,11 @@ void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,
 #define snd_pcm_group_for_each_entry(s, substream) \
 	list_for_each_entry(s, &substream->group->substreams, link_list)
 
+#define for_each_pcm_streams(stream)			\
+	for (stream  = SNDRV_PCM_STREAM_PLAYBACK;	\
+	     stream <= SNDRV_PCM_STREAM_LAST;		\
+	     stream++)
+
 /**
  * snd_pcm_running - Check whether the substream is in a running state
  * @substream: substream to check
-- 
2.17.1



More information about the Alsa-devel mailing list