diff mbox series

[16/20] ASoC: soc-dai.c: replace dpcm_playback/capture to playback/capture_only

Message ID 87fs7up4t5.wl-kuninori.morimoto.gx@renesas.com
State Superseded
Headers show
Series ASoC: replace dpcm_playback/capture to playback/capture_only | expand

Commit Message

Kuninori Morimoto May 18, 2023, 5:49 a.m. UTC
soc_get_playback_capture() is now handling DPCM and normal comprehensively
for playback/capture stream. We can use playback/capture_only flag
instead of using dpcm_playback/capture. This patch replace these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dai.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Amadeusz Sławiński May 18, 2023, 10:39 a.m. UTC | #1
On 5/18/2023 7:49 AM, Kuninori Morimoto wrote:
> soc_get_playback_capture() is now handling DPCM and normal comprehensively
> for playback/capture stream. We can use playback/capture_only flag
> instead of using dpcm_playback/capture. This patch replace these.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   sound/soc/soc-dai.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
> index 02dd64dea179..e61414bb0b72 100644
> --- a/sound/soc/soc-dai.c
> +++ b/sound/soc/soc-dai.c
> @@ -505,8 +505,8 @@ void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link)
>   		supported[direction] = supported_cpu && supported_codec;
>   	}
>   
> -	dai_link->dpcm_playback = supported[SNDRV_PCM_STREAM_PLAYBACK];
> -	dai_link->dpcm_capture  = supported[SNDRV_PCM_STREAM_CAPTURE];
> +	dai_link->playback_only = !supported[SNDRV_PCM_STREAM_CAPTURE];
> +	dai_link->capture_only  = !supported[SNDRV_PCM_STREAM_PLAYBACK];
>   }
>   EXPORT_SYMBOL_GPL(snd_soc_dai_link_set_capabilities);
>   

What happens if somehow both supported[SNDRV_PCM_STREAM_CAPTURE] and 
supported[SNDRV_PCM_STREAM_PLAYBACK] are false, and so both 
dai_link->playback_only & dai_link->capture_only get set to true?

Perhaps assignment should be more like:
dai_link->playback_only = supported[SNDRV_PCM_STREAM_PLAYBACK] && 
!supported[SNDRV_PCM_STREAM_CAPTURE];
dai_link->playback_only = supported[SNDRV_PCM_STREAM_CAPTURE] && 
!supported[SNDRV_PCM_STREAM_PLAYBACK];
diff mbox series

Patch

diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
index 02dd64dea179..e61414bb0b72 100644
--- a/sound/soc/soc-dai.c
+++ b/sound/soc/soc-dai.c
@@ -505,8 +505,8 @@  void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link)
 		supported[direction] = supported_cpu && supported_codec;
 	}
 
-	dai_link->dpcm_playback = supported[SNDRV_PCM_STREAM_PLAYBACK];
-	dai_link->dpcm_capture  = supported[SNDRV_PCM_STREAM_CAPTURE];
+	dai_link->playback_only = !supported[SNDRV_PCM_STREAM_CAPTURE];
+	dai_link->capture_only  = !supported[SNDRV_PCM_STREAM_PLAYBACK];
 }
 EXPORT_SYMBOL_GPL(snd_soc_dai_link_set_capabilities);