summaryrefslogtreecommitdiff
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2019-08-08 14:54:44 +0900
committerMark Brown <broonie@kernel.org>2019-08-09 18:13:58 +0100
commitc2b71c71037bea7765aa6ff37824520d19108769 (patch)
tree38f96c77c57dd99f53dcee439b04cadf55ea3fb3 /sound/soc/soc-core.c
parentb812cd5864548bd9718879896fdd2822d3cb3d76 (diff)
ASoC: soc-core: add for_each_xxx macro for aux_dev
To be more readable code, this patch adds new for_each_xxx() macro for aux_dev. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87ftmc6w8s.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4af382d52675..e9f44505cc3e 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1533,9 +1533,9 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
return ret;
}
-static int soc_bind_aux_dev(struct snd_soc_card *card, int num)
+static int soc_bind_aux_dev(struct snd_soc_card *card,
+ struct snd_soc_aux_dev *aux_dev)
{
- struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num];
struct snd_soc_component *component;
/* codecs, usually analog devices */
@@ -1544,6 +1544,7 @@ static int soc_bind_aux_dev(struct snd_soc_card *card, int num)
return -EPROBE_DEFER;
component->init = aux_dev->init;
+ /* see for_each_card_auxs */
list_add(&component->card_aux_list, &card->aux_comp_list);
return 0;
@@ -1556,7 +1557,7 @@ static int soc_probe_aux_devices(struct snd_soc_card *card)
int ret;
for_each_comp_order(order) {
- list_for_each_entry(comp, &card->aux_comp_list, card_aux_list) {
+ for_each_card_auxs(card, comp) {
if (comp->driver->probe_order == order) {
ret = soc_probe_component(card, comp);
if (ret < 0) {
@@ -1578,8 +1579,7 @@ static void soc_remove_aux_devices(struct snd_soc_card *card)
int order;
for_each_comp_order(order) {
- list_for_each_entry_safe(comp, _comp,
- &card->aux_comp_list, card_aux_list) {
+ for_each_card_auxs_safe(card, comp, _comp) {
if (comp->driver->remove_order == order) {
soc_remove_component(comp);
@@ -1913,6 +1913,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
{
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai_link *dai_link;
+ struct snd_soc_aux_dev *aux;
int ret, i, order;
mutex_lock(&client_mutex);
@@ -1943,8 +1944,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
}
/* bind aux_devs too */
- for (i = 0; i < card->num_aux_devs; i++) {
- ret = soc_bind_aux_dev(card, i);
+ for_each_card_pre_auxs(card, i, aux) {
+ ret = soc_bind_aux_dev(card, aux);
if (ret != 0)
goto probe_end;
}