From 8c186bc6b77be4913f5869a68d547dc52976fa9d Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 14 Oct 2026 02:59:21 +0000 Subject: [PATCH] ASoC: soc-component: move component_list to soc-component.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit struct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c. Move component_list to soc-component.c Signed-off-by: Kuninori Morimoto Reviewed-by: Alvin Šipraga Link: https://patch.msgid.link/87a4ohyol2.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/soc-component.c | 6 ++++++ sound/soc/soc-core.c | 7 +------ sound/soc/soc-internal.h | 4 ++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c index 962cd7ab3cc2..86ede607ba31 100644 --- a/sound/soc/soc-component.c +++ b/sound/soc/soc-component.c @@ -31,6 +31,12 @@ static inline int _soc_component_ret_reg_rw(struct snd_soc_component *component, func, component->name, reg); } +static LIST_HEAD(component_list); +struct list_head *snd_soc_component_get_list_head(void) +{ + return &component_list; +} + const char *snd_soc_component_name(struct snd_soc_component *component) { return component->name; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index cd318d232ee3..0e935de91d0a 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -47,13 +47,8 @@ #include DEFINE_MUTEX(client_mutex); - -static LIST_HEAD(component_list); static LIST_HEAD(unbind_card_list); -#define for_each_component(component) \ - list_for_each_entry(component, &component_list, list) - /* * This is used if driver don't need to have CPU/Codec/Platform * dai_link. see soc.h @@ -2396,7 +2391,7 @@ int snd_soc_component_register(struct snd_soc_component *component, } /* see for_each_component */ - list_add(&component->list, &component_list); + list_add(&component->list, snd_soc_component_get_list_head()); list_for_each_entry_safe(card, c, &unbind_card_list, list) call_soc_bind_card(card); diff --git a/sound/soc/soc-internal.h b/sound/soc/soc-internal.h index 17ed22c2cd50..b844b27574c8 100644 --- a/sound/soc/soc-internal.h +++ b/sound/soc/soc-internal.h @@ -44,5 +44,9 @@ bool snd_soc_component_matches_dlc(struct snd_soc_component *component, const struct snd_soc_dai_link_component *dlc); void snd_soc_component_remove(struct snd_soc_component *component, int probed); int snd_soc_component_probe(struct snd_soc_component *component, struct snd_soc_card *card); +struct list_head *snd_soc_component_get_list_head(void); + +#define for_each_component(component) \ + list_for_each_entry(component, snd_soc_component_get_list_head(), list) #endif /* __SOC_INTERNAL_H */