Commit 01005a72 authored by Liam Girdwood's avatar Liam Girdwood Committed by Mark Brown

ASoC: dapm: Fix locking during codec shutdown

Codec shutdown performs a DAPM power sequence that might cause conflicts
and/or race conditions if another stream power event is running simultaneously.
Use card's dapm mutex to protect any potential race condition between them.
Signed-off-by: default avatarMisael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: default avatarLiam Girdwood <lrg@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
parent 32fee7af
...@@ -3537,10 +3537,13 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_free); ...@@ -3537,10 +3537,13 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_free);
static void soc_dapm_shutdown_codec(struct snd_soc_dapm_context *dapm) static void soc_dapm_shutdown_codec(struct snd_soc_dapm_context *dapm)
{ {
struct snd_soc_card *card = dapm->card;
struct snd_soc_dapm_widget *w; struct snd_soc_dapm_widget *w;
LIST_HEAD(down_list); LIST_HEAD(down_list);
int powerdown = 0; int powerdown = 0;
mutex_lock(&card->dapm_mutex);
list_for_each_entry(w, &dapm->card->widgets, list) { list_for_each_entry(w, &dapm->card->widgets, list) {
if (w->dapm != dapm) if (w->dapm != dapm)
continue; continue;
...@@ -3563,6 +3566,8 @@ static void soc_dapm_shutdown_codec(struct snd_soc_dapm_context *dapm) ...@@ -3563,6 +3566,8 @@ static void soc_dapm_shutdown_codec(struct snd_soc_dapm_context *dapm)
snd_soc_dapm_set_bias_level(dapm, snd_soc_dapm_set_bias_level(dapm,
SND_SOC_BIAS_STANDBY); SND_SOC_BIAS_STANDBY);
} }
mutex_unlock(&card->dapm_mutex);
} }
/* /*
......
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