ASoC: soc-core: set rtd->num_cpu/codec at soc_new_pcm_runtime()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 30 Mar 2020 01:47:54 +0000 (10:47 +0900)
committerMark Brown <broonie@kernel.org>
Tue, 14 Apr 2020 13:00:45 +0000 (14:00 +0100)
rtd->cpu_dais/codec_dais are set at soc_new_pcm_runtime().
rtd->num_cpus/codecs should be set there.
This patch do it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87h7y6bol1.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-core.c

index 4ad64b9..8cef4fd 100644 (file)
@@ -490,6 +490,8 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
         */
        rtd->cpu_dais   = &rtd->dais[0];
        rtd->codec_dais = &rtd->dais[dai_link->num_cpus];
+       rtd->num_cpus   = dai_link->num_cpus;
+       rtd->num_codecs = dai_link->num_codecs;
 
        /*
         * rtd remaining settings
@@ -989,7 +991,6 @@ int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
        if (!rtd)
                return -ENOMEM;
 
-       rtd->num_cpus = dai_link->num_cpus;
        for_each_link_cpus(dai_link, i, cpu) {
                asoc_rtd_to_cpu(rtd, i) = snd_soc_find_dai(cpu);
                if (!asoc_rtd_to_cpu(rtd, i)) {
@@ -1004,7 +1005,6 @@ int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
        rtd->cpu_dai = rtd->cpu_dais[0];
 
        /* Find CODEC from registered CODECs */
-       rtd->num_codecs = dai_link->num_codecs;
        for_each_link_codecs(dai_link, i, codec) {
                asoc_rtd_to_codec(rtd, i) = snd_soc_find_dai(codec);
                if (!asoc_rtd_to_codec(rtd, i)) {