diff mbox series

[v3,10/18] ASoC: soc.h: add for_each_pcm_streams()

Message ID 87wo8m9cwq.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show
Series ASoC: soc-pcm cleanup step3 | expand

Commit Message

Kuninori Morimoto Feb. 17, 2020, 2:16 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ALSA SoC 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@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 include/sound/pcm.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Takashi Iwai Feb. 17, 2020, 7:55 a.m. UTC | #1
On Mon, 17 Feb 2020 03:16:23 +0100,
Kuninori Morimoto wrote:
> 
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> ALSA SoC has SNDRV_PCM_STREAM_PLAYBACK/CAPTURE everywhere.
> Having for_each_xxxx macro is useful.
> This patch adds for_each_pcm_streams() for it.

The subject prefix should be "ALSA" as it's ALSA-common code.

Other than that,
  Acked-by: Takashi Iwai <tiwai@suse.de>

BTW, Mark, if you merge this series, please send the pull request
earlier to me.  I'm going to apply the similar cleanups in the whole
rest ALSA code, and this change is needed at first.


thanks,

Takashi

> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> ---
>  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
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
Kuninori Morimoto Feb. 17, 2020, 8:24 a.m. UTC | #2
Hi Takashi-san

Thank you for your review.

> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > ALSA SoC has SNDRV_PCM_STREAM_PLAYBACK/CAPTURE everywhere.
> > Having for_each_xxxx macro is useful.
> > This patch adds for_each_pcm_streams() for it.
> 
> The subject prefix should be "ALSA" as it's ALSA-common code.

Oops. And it needs to fixup "soc.h" to "pcm.h" on Subject.
Will post v4 patch set soon

Thank you for your help !!
Best regards
---
Kuninori Morimoto
diff mbox series

Patch

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