ASoC: soc-core: remove snd_soc_rtdcom_list
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Fri, 10 Jan 2020 02:35:21 +0000 (11:35 +0900)
committerMark Brown <broonie@kernel.org>
Fri, 10 Jan 2020 13:31:22 +0000 (13:31 +0000)
commit613fb50059cf19aa6acbc503a00265d9151c0b09
tree65c16095cdfbbef874c085d6ad552983fea255c6
parenta84188eced6109983af54f9435a26d21eac3f8cc
ASoC: soc-core: remove snd_soc_rtdcom_list

Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.

struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};

struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};

The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()

int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...

/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...

/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}

}

It shows, it is possible to know how many components will be
connected to rtd by using

dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms

If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h
sound/soc/soc-component.c
sound/soc/soc-compress.c
sound/soc/soc-core.c
sound/soc/soc-pcm.c