Commit 946d92a1 authored by Mark Brown's avatar Mark Brown

ASoC: dapm: Don't create routes when creating kcontrols

Attempting to create the route as part of adding a mux control causes us
to attempt to add the same route twice since we loop over all sources
for the mux after creating the control. Instead do the addition in the
callers.
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
parent f2e53742
...@@ -665,7 +665,7 @@ static int dapm_is_shared_kcontrol(struct snd_soc_dapm_context *dapm, ...@@ -665,7 +665,7 @@ static int dapm_is_shared_kcontrol(struct snd_soc_dapm_context *dapm,
* create it. Either way, add the widget into the control's widget list * create it. Either way, add the widget into the control's widget list
*/ */
static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
int kci, struct snd_soc_dapm_path *path) int kci)
{ {
struct snd_soc_dapm_context *dapm = w->dapm; struct snd_soc_dapm_context *dapm = w->dapm;
struct snd_card *card = dapm->card->snd_card; struct snd_card *card = dapm->card->snd_card;
...@@ -766,7 +766,6 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, ...@@ -766,7 +766,6 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
return ret; return ret;
w->kcontrols[kci] = kcontrol; w->kcontrols[kci] = kcontrol;
dapm_kcontrol_add_path(kcontrol, path);
return 0; return 0;
} }
...@@ -790,9 +789,11 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w) ...@@ -790,9 +789,11 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w)
continue; continue;
} }
ret = dapm_create_or_share_mixmux_kcontrol(w, i, path); ret = dapm_create_or_share_mixmux_kcontrol(w, i);
if (ret < 0) if (ret < 0)
return ret; return ret;
dapm_kcontrol_add_path(w->kcontrols[i], path);
} }
} }
...@@ -818,10 +819,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w) ...@@ -818,10 +819,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
return -EINVAL; return -EINVAL;
} }
path = list_first_entry(&w->sources, struct snd_soc_dapm_path, ret = dapm_create_or_share_mixmux_kcontrol(w, 0);
list_sink);
ret = dapm_create_or_share_mixmux_kcontrol(w, 0, path);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment