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 */