summaryrefslogtreecommitdiff
path: root/include/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2020-01-10 05:35:21 +0300
committerMark Brown <broonie@kernel.org>2020-01-10 16:31:22 +0300
commit613fb50059cf19aa6acbc503a00265d9151c0b09 (patch)
tree65c16095cdfbbef874c085d6ad552983fea255c6 /include/sound
parenta84188eced6109983af54f9435a26d21eac3f8cc (diff)
downloadlinux-613fb50059cf19aa6acbc503a00265d9151c0b09.tar.xz
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>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 9787c80e548b..0513f30a0209 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -736,19 +736,9 @@ struct snd_soc_compr_ops {
int (*trigger)(struct snd_compr_stream *);
};
-struct snd_soc_rtdcom_list {
- struct snd_soc_component *component;
- struct list_head list; /* rtd::component_list */
-};
struct snd_soc_component*
snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd,
const char *driver_name);
-#define for_each_rtd_components(rtd, rtdcom, _component) \
- for (rtdcom = list_first_entry(&(rtd)->component_list, \
- typeof(*rtdcom), list); \
- (&rtdcom->list != &(rtd)->component_list) && \
- (_component = rtdcom->component); \
- rtdcom = list_next_entry(rtdcom, list))
struct snd_soc_dai_link_component {
const char *name;
@@ -1150,12 +1140,18 @@ struct snd_soc_pcm_runtime {
unsigned int num; /* 0-based and monotonic increasing */
struct list_head list; /* rtd list of the soc card */
- struct list_head component_list; /* list of connected components */
/* bit field */
unsigned int pop_wait:1;
unsigned int fe_compr:1; /* for Dynamic PCM */
+
+ int num_components;
+ struct snd_soc_component *components[0]; /* CPU/Codec/Platform */
};
+#define for_each_rtd_components(rtd, i, component) \
+ for ((i) = 0; \
+ ((i) < rtd->num_components) && ((component) = rtd->components[i]);\
+ (i)++)
#define for_each_rtd_codec_dai(rtd, i, dai)\
for ((i) = 0; \
((i) < rtd->num_codecs) && ((dai) = rtd->codec_dais[i]); \