ASoC: Serialize access to dapm_power_widgets()
cover ASoC: Serialize access to dapm_power_widgets()
From: Eero Nurkkala <[email protected]>
It was detected that in some rare instances the dapm powering cycles got out of order. That lead to investigation of the use of all the mutexes used in the ASoC core.
The patch is tested with 2.6.28 (with lockdep also) , but applies to v2.6.32-rc3. Please review.
PATCH 1/1 ASoC: Serialize access to dapm_power_widgets()
From: Eero Nurkkala <[email protected]>
Access to damp_power_widgets() is assumed to be single-threaded. Concurrent accesses to dapm_power_widgets() may result in unpredictable behavior.
Calls from:close_delayed_work()soc_codec_close()soc_pcm_prepare()soc_suspend()soc_resume_deferred()
to snd_soc_dapm_stream_event() do not have the codec->mutex taken to cover the call to dapm_power_widgets(). Thus, take the mutex in these paths also to assure single-threaded use of dapm_power_widgets().
--- sound/soc/soc-dapm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/soc-dapm.c +1 -1
@@ -2071,9 +2071,9 @@ int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, } } } -mutex_unlock (&codec->mutex);dapm_power_widgets (codec, event); +mutex_unlock (&codec->mutex);dump_dapm (codec, __func__);return 0 ; }
Signature · 1 line
1.6.0.4
sound/soc/soc-dapm.c int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, · line 2079
Quoted 9 lines · On Mon, Oct 12, 2009 at 08:41:59AM +0300, [email protected] wrote:
sound/soc/soc-dapm.c +1
-1} } -mutex_unlock (&codec->mutex);dapm_power_widgets (codec, event); +mutex_unlock (&codec->mutex);dump_dapm (codec, __func__);return 0 ; }
I would've said we should protect dump_dapm() here too but since it's built out by default and I intend to kill it shortly there's no point in respinning for that so I'll apply this - thanks!
Quoted 9 lines · On Mon, Oct 12, 2009 at 08:41:58AM +0300, [email protected] wrote:
From: Eero Nurkkala <[email protected]>
It was detected that in some rare instances the dapm powering cycles got out of order. That lead to investigation of the use of all the mutexes used in the ASoC core.
The patch is tested with 2.6.28 (with lockdep also) , but applies to v2.6.32-rc3. Please review.
Please don't send 0/1 mails like this - if there's anything to say about the patch please include it in the patch itself. If it shouldn't make it into the commit message include it after the ---. 0/n mails are only useful when introducing a longer series of patches.