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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
  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];



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux