From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Current Card has Codec list (= codec_dev_list), but Codec will be removed in the future. Because of this reason, this patch adds new Component list in Card. In the same time, current Card has AUX list (= aux_comp_list). This patch replaces it by Component list and new flag (= has_auxliary) too
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/sound/soc.h | 7 ++++--- sound/soc/soc-core.c | 21 ++++++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h index 4f1c784..e96affa 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -807,9 +807,10 @@ struct snd_soc_component {
unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ unsigned int registered_as_component:1; + unsigned int has_auxiliary:1; /* for auxiliary component of the card */
struct list_head list; - struct list_head list_aux; /* for auxiliary component of the card */ + struct list_head card_list;
struct snd_soc_dai_driver *dai_drv; int num_dai; @@ -1148,7 +1149,6 @@ struct snd_soc_card { */ struct snd_soc_aux_dev *aux_dev; int num_aux_devs; - struct list_head aux_comp_list;
const struct snd_kcontrol_new *controls; int num_controls; @@ -1171,6 +1171,7 @@ struct snd_soc_card {
/* lists of probed devices belonging to this card */ struct list_head codec_dev_list; + struct list_head component_dev_list;
struct list_head widgets; struct list_head paths; @@ -1545,7 +1546,7 @@ static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) INIT_LIST_HEAD(&card->widgets); INIT_LIST_HEAD(&card->paths); INIT_LIST_HEAD(&card->dapm_list); - INIT_LIST_HEAD(&card->aux_comp_list); + INIT_LIST_HEAD(&card->component_dev_list); }
static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c0bbcd9..2a00b5e 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1076,6 +1076,8 @@ static void soc_remove_component(struct snd_soc_component *component) if (component->codec) list_del(&component->codec->card_list);
+ list_del(&component->card_list); + if (component->remove) component->remove(component);
@@ -1448,6 +1450,8 @@ static int soc_probe_component(struct snd_soc_card *card, if (component->codec) list_add(&component->codec->card_list, &card->codec_dev_list);
+ list_add(&component->card_list, &card->component_dev_list); + return 0;
err_probe: @@ -1706,7 +1710,8 @@ static int soc_bind_aux_dev(struct snd_soc_card *card, int num) }
component->init = aux_dev->init; - list_add(&component->list_aux, &card->aux_comp_list); + component->has_auxiliary = 1; + return 0;
err_defer: @@ -1722,7 +1727,10 @@ static int soc_probe_aux_devices(struct snd_soc_card *card)
for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST; order++) { - list_for_each_entry(comp, &card->aux_comp_list, list_aux) { + list_for_each_entry(comp, &card->component_dev_list, card_list) { + if (!comp->has_auxiliary) + continue; + if (comp->driver->probe_order == order) { ret = soc_probe_component(card, comp); if (ret < 0) { @@ -1746,11 +1754,14 @@ static void soc_remove_aux_devices(struct snd_soc_card *card) for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST; order++) { list_for_each_entry_safe(comp, _comp, - &card->aux_comp_list, list_aux) { + &card->component_dev_list, card_list) { + + if (!comp->has_auxiliary) + continue; + if (comp->driver->remove_order == order) { soc_remove_component(comp); - /* remove it from the card's aux_comp_list */ - list_del(&comp->list_aux); + comp->has_auxiliary = 0; } } }