Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98407efc authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown
Browse files

ASoC: dapm: Do not add un-muxed paths to MUX control



Paths that are directly connected to a MUX widget are not affected by
changes to the MUX's control. Rather than checking if a path is directly
connected each time the MUX is updated do it only once when MUX is created.

We can also remove the check for e->texts[mux] != NULL, since if that
condition was true the code would have had already crashed much earlier (And
generally speaking if a enum's 'texts' entry is NULL it's a bug in the
driver).

Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4a201948
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -738,8 +738,10 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
	if (ret < 0)
	if (ret < 0)
		return ret;
		return ret;


	list_for_each_entry(path, &w->sources, list_sink)
	list_for_each_entry(path, &w->sources, list_sink) {
		if (path->name)
			dapm_kcontrol_add_path(w->kcontrols[0], path);
			dapm_kcontrol_add_path(w->kcontrols[0], path);
	}


	return 0;
	return 0;
}
}
@@ -1955,9 +1957,6 @@ static int soc_dapm_mux_update_power(struct snd_soc_card *card,


	/* find dapm widget path assoc with kcontrol */
	/* find dapm widget path assoc with kcontrol */
	dapm_kcontrol_for_each_path(path, kcontrol) {
	dapm_kcontrol_for_each_path(path, kcontrol) {
		if (!path->name || !e->texts[mux])
			continue;

		found = 1;
		found = 1;
		/* we now need to match the string in the enum to the path */
		/* we now need to match the string in the enum to the path */
		if (!(strcmp(path->name, e->texts[mux])))
		if (!(strcmp(path->name, e->texts[mux])))