diff mbox series

[1/2] ASoC: SOF: (cosmetic) use for_each_pcm_streams() in sof_dai_load()

Message ID 20200324122921.29582-2-guennadi.liakhovetski@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series ASoC: SOF: initialise work immediately | expand

Commit Message

Guennadi Liakhovetski March 24, 2020, 12:29 p.m. UTC
Use for_each_pcm_streams() to enumerate streams in sof_dai_load()
instead of doing that manually.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
---
 sound/soc/sof/topology.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Pierre-Louis Bossart March 24, 2020, 1:29 p.m. UTC | #1
Guennadi, who are the intended reviewers/maintainers here and which tree 
is this supposed to be merged on?

Patch0 has everyone copied, patch 1/2 only target mailing lists, and I 
haven't seen any PR/CI for this?

I am flexible with processes, I am just lost here on what you had in mind.

Thanks
-Pierre

On 3/24/20 7:29 AM, Guennadi Liakhovetski wrote:
> Use for_each_pcm_streams() to enumerate streams in sof_dai_load()
> instead of doing that manually.
> 
> Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
> ---
>   sound/soc/sof/topology.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
> index 058de94..54437ca 100644
> --- a/sound/soc/sof/topology.c
> +++ b/sound/soc/sof/topology.c
> @@ -2448,7 +2448,7 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
>   	struct snd_soc_tplg_stream_caps *caps;
>   	struct snd_soc_tplg_private *private = &pcm->priv;
>   	struct snd_sof_pcm *spcm;
> -	int stream = SNDRV_PCM_STREAM_PLAYBACK;
> +	int stream;
>   	int ret = 0;
>   
>   	/* nothing to do for BEs atm */
> @@ -2460,8 +2460,9 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
>   		return -ENOMEM;
>   
>   	spcm->scomp = scomp;
> -	spcm->stream[SNDRV_PCM_STREAM_PLAYBACK].comp_id = COMP_ID_UNASSIGNED;
> -	spcm->stream[SNDRV_PCM_STREAM_CAPTURE].comp_id = COMP_ID_UNASSIGNED;
> +
> +	for_each_pcm_streams(stream)
> +		spcm->stream[stream].comp_id = COMP_ID_UNASSIGNED;
>   
>   	spcm->pcm = *pcm;
>   	dev_dbg(scomp->dev, "tplg: load pcm %s\n", pcm->dai_name);
> @@ -2482,8 +2483,10 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
>   	if (!spcm->pcm.playback)
>   		goto capture;
>   
> +	stream = SNDRV_PCM_STREAM_PLAYBACK;
> +
>   	dev_vdbg(scomp->dev, "tplg: pcm %s stream tokens: playback d0i3:%d\n",
> -		 spcm->pcm.pcm_name, spcm->stream[0].d0i3_compatible);
> +		 spcm->pcm.pcm_name, spcm->stream[stream].d0i3_compatible);
>   
>   	caps = &spcm->pcm.caps[stream];
>   
> @@ -2513,7 +2516,7 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
>   		return ret;
>   
>   	dev_vdbg(scomp->dev, "tplg: pcm %s stream tokens: capture d0i3:%d\n",
> -		 spcm->pcm.pcm_name, spcm->stream[1].d0i3_compatible);
> +		 spcm->pcm.pcm_name, spcm->stream[stream].d0i3_compatible);
>   
>   	caps = &spcm->pcm.caps[stream];
>   
>
Guennadi Liakhovetski March 24, 2020, 2:06 p.m. UTC | #2
Hi Pierre,

On Tue, Mar 24, 2020 at 08:29:43AM -0500, Pierre-Louis Bossart wrote:
> Guennadi, who are the intended reviewers/maintainers here and which tree is
> this supposed to be merged on?
> 
> Patch0 has everyone copied, patch 1/2 only target mailing lists, and I
> haven't seen any PR/CI for this?

Yes, as explained in my reply to Mark, I didn't want to spam everybody's mail 
boxes with all the patches, so I only copied the "patch 0" to maintainers 
and sent the patches themselves to lists only.

> I am flexible with processes, I am just lost here on what you had in mind.

I was advised to make this a separate patch from my VirtIO patch series, so 
I did that and sent it again directly to the mailing lists. But we can take 
it back to the local review process, if you prefer.

Thanks
Guennadi

> Thanks
> -Pierre
> 
> On 3/24/20 7:29 AM, Guennadi Liakhovetski wrote:
> > Use for_each_pcm_streams() to enumerate streams in sof_dai_load()
> > instead of doing that manually.
> > 
> > Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
> > ---
> >   sound/soc/sof/topology.c | 13 ++++++++-----
> >   1 file changed, 8 insertions(+), 5 deletions(-)
> > 
> > diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
> > index 058de94..54437ca 100644
> > --- a/sound/soc/sof/topology.c
> > +++ b/sound/soc/sof/topology.c
> > @@ -2448,7 +2448,7 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
> >   	struct snd_soc_tplg_stream_caps *caps;
> >   	struct snd_soc_tplg_private *private = &pcm->priv;
> >   	struct snd_sof_pcm *spcm;
> > -	int stream = SNDRV_PCM_STREAM_PLAYBACK;
> > +	int stream;
> >   	int ret = 0;
> >   	/* nothing to do for BEs atm */
> > @@ -2460,8 +2460,9 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
> >   		return -ENOMEM;
> >   	spcm->scomp = scomp;
> > -	spcm->stream[SNDRV_PCM_STREAM_PLAYBACK].comp_id = COMP_ID_UNASSIGNED;
> > -	spcm->stream[SNDRV_PCM_STREAM_CAPTURE].comp_id = COMP_ID_UNASSIGNED;
> > +
> > +	for_each_pcm_streams(stream)
> > +		spcm->stream[stream].comp_id = COMP_ID_UNASSIGNED;
> >   	spcm->pcm = *pcm;
> >   	dev_dbg(scomp->dev, "tplg: load pcm %s\n", pcm->dai_name);
> > @@ -2482,8 +2483,10 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
> >   	if (!spcm->pcm.playback)
> >   		goto capture;
> > +	stream = SNDRV_PCM_STREAM_PLAYBACK;
> > +
> >   	dev_vdbg(scomp->dev, "tplg: pcm %s stream tokens: playback d0i3:%d\n",
> > -		 spcm->pcm.pcm_name, spcm->stream[0].d0i3_compatible);
> > +		 spcm->pcm.pcm_name, spcm->stream[stream].d0i3_compatible);
> >   	caps = &spcm->pcm.caps[stream];
> > @@ -2513,7 +2516,7 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
> >   		return ret;
> >   	dev_vdbg(scomp->dev, "tplg: pcm %s stream tokens: capture d0i3:%d\n",
> > -		 spcm->pcm.pcm_name, spcm->stream[1].d0i3_compatible);
> > +		 spcm->pcm.pcm_name, spcm->stream[stream].d0i3_compatible);
> >   	caps = &spcm->pcm.caps[stream];
> >
diff mbox series

Patch

diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 058de94..54437ca 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -2448,7 +2448,7 @@  static int sof_dai_load(struct snd_soc_component *scomp, int index,
 	struct snd_soc_tplg_stream_caps *caps;
 	struct snd_soc_tplg_private *private = &pcm->priv;
 	struct snd_sof_pcm *spcm;
-	int stream = SNDRV_PCM_STREAM_PLAYBACK;
+	int stream;
 	int ret = 0;
 
 	/* nothing to do for BEs atm */
@@ -2460,8 +2460,9 @@  static int sof_dai_load(struct snd_soc_component *scomp, int index,
 		return -ENOMEM;
 
 	spcm->scomp = scomp;
-	spcm->stream[SNDRV_PCM_STREAM_PLAYBACK].comp_id = COMP_ID_UNASSIGNED;
-	spcm->stream[SNDRV_PCM_STREAM_CAPTURE].comp_id = COMP_ID_UNASSIGNED;
+
+	for_each_pcm_streams(stream)
+		spcm->stream[stream].comp_id = COMP_ID_UNASSIGNED;
 
 	spcm->pcm = *pcm;
 	dev_dbg(scomp->dev, "tplg: load pcm %s\n", pcm->dai_name);
@@ -2482,8 +2483,10 @@  static int sof_dai_load(struct snd_soc_component *scomp, int index,
 	if (!spcm->pcm.playback)
 		goto capture;
 
+	stream = SNDRV_PCM_STREAM_PLAYBACK;
+
 	dev_vdbg(scomp->dev, "tplg: pcm %s stream tokens: playback d0i3:%d\n",
-		 spcm->pcm.pcm_name, spcm->stream[0].d0i3_compatible);
+		 spcm->pcm.pcm_name, spcm->stream[stream].d0i3_compatible);
 
 	caps = &spcm->pcm.caps[stream];
 
@@ -2513,7 +2516,7 @@  static int sof_dai_load(struct snd_soc_component *scomp, int index,
 		return ret;
 
 	dev_vdbg(scomp->dev, "tplg: pcm %s stream tokens: capture d0i3:%d\n",
-		 spcm->pcm.pcm_name, spcm->stream[1].d0i3_compatible);
+		 spcm->pcm.pcm_name, spcm->stream[stream].d0i3_compatible);
 
 	caps = &spcm->pcm.caps[stream];