aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-08-12 18:28:42 -0400
committerMark Brown <broonie@linaro.org>2013-08-13 05:19:57 -0400
commit946d92a100f6c36b1c53922d5105b3c19a59173d (patch)
tree87dbb9ac2103b823c1f2ef85a8612bc687e8d817
parentf2e537425a6eae2d70ece5f62c26611f316b70f9 (diff)
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: Mark Brown <broonie@linaro.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
-rw-r--r--sound/soc/soc-dapm.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 662a904c2b79..b885a9bedc4e 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -665,7 +665,7 @@ static int dapm_is_shared_kcontrol(struct snd_soc_dapm_context *dapm,
665 * create it. Either way, add the widget into the control's widget list 665 * create it. Either way, add the widget into the control's widget list
666 */ 666 */
667static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, 667static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
668 int kci, struct snd_soc_dapm_path *path) 668 int kci)
669{ 669{
670 struct snd_soc_dapm_context *dapm = w->dapm; 670 struct snd_soc_dapm_context *dapm = w->dapm;
671 struct snd_card *card = dapm->card->snd_card; 671 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 return ret; 766 return ret;
767 767
768 w->kcontrols[kci] = kcontrol; 768 w->kcontrols[kci] = kcontrol;
769 dapm_kcontrol_add_path(kcontrol, path);
770 769
771 return 0; 770 return 0;
772} 771}
@@ -790,9 +789,11 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w)
790 continue; 789 continue;
791 } 790 }
792 791
793 ret = dapm_create_or_share_mixmux_kcontrol(w, i, path); 792 ret = dapm_create_or_share_mixmux_kcontrol(w, i);
794 if (ret < 0) 793 if (ret < 0)
795 return ret; 794 return ret;
795
796 dapm_kcontrol_add_path(w->kcontrols[i], path);
796 } 797 }
797 } 798 }
798 799
@@ -818,10 +819,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
818 return -EINVAL; 819 return -EINVAL;
819 } 820 }
820 821
821 path = list_first_entry(&w->sources, struct snd_soc_dapm_path, 822 ret = dapm_create_or_share_mixmux_kcontrol(w, 0);
822 list_sink);
823
824 ret = dapm_create_or_share_mixmux_kcontrol(w, 0, path);
825 if (ret < 0) 823 if (ret < 0)
826 return ret; 824 return ret;
827 825