soc_get_playback_capture() (A) is handling both DPCM (X) / Normal (Y) connection.
(A) static int soc_get_playback_capture(...) { ... ^ if (dai_link->dynamic || dai_link->no_pcm) { (X) ... v ^ } else { | ... | for_each_rtd_codec_dais(rtd, i, codec_dai) { | if (dai_link->num_cpus == 1) { |(a) cpu_dai = ... (Y) } else if (dai_link->num_cpus == dai_link->num_codecs) { |(b) cpu_dai = ... | } | ... | } | ... v } ... }
In Normal connection case (Y), it is checking number of CPU / Codec. (a) is for Single CPU case (b) is for Multi CPU case
We can simply merge (a) and (b). Because it is doing same judgement, same operation.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Reviewed-by: Amadeusz Sławiński amadeuszx.slawinski@linux.intel.com --- sound/soc/soc-pcm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index b99c0aa98d09..c1ddd3fc71b0 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2795,11 +2795,7 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
for_each_rtd_codec_dais(rtd, i, codec_dai) { - if (dai_link->num_cpus == 1) { - cpu_dai = asoc_rtd_to_cpu(rtd, 0); - } else if (dai_link->num_cpus == dai_link->num_codecs) { - cpu_dai = asoc_rtd_to_cpu(rtd, i); - } + cpu_dai = asoc_rtd_to_cpu(rtd, i);
if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) && snd_soc_dai_stream_valid(cpu_dai, cpu_playback))