All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: Use nested lock for snd_soc_dapm_mutex_lock
@ 2015-12-29 16:25 Charles Keepax
  2015-12-29 16:25 ` [PATCH 2/2] ASoC: wm5110: Use helper function to lock the DAPM mutex Charles Keepax
  2015-12-30 18:05 ` Applied "ASoC: Use nested lock for snd_soc_dapm_mutex_lock" " Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Charles Keepax @ 2015-12-29 16:25 UTC (permalink / raw)
  To: broonie; +Cc: alsa-devel, patches, lgirdwood

snd_soc_dapm_mutex_lock currently uses the un-nested call which can
cause lockdep warnings when called from control handlers (a relatively
common usage) and using modules. As creating the control causes a
potential mutex inversion with the handler, creating the control will
take the controls_rwsem under the dapm_mutex and accessing the control
will take the dapm_mutex under controls_rwsem.

All the users look like they want to be using the runtime class of the
lock anyway, so this patch just changes snd_soc_dapm_mutex_lock to use
the nested call, with the SND_SOC_DAPM_CLASS_RUNTIME class.

Fixes: f6d5e586b416 ("ASoC: dapm: Add helpers to lock/unlock DAPM mutex")
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 include/sound/soc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index a2deeb9..aae55d0 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1687,7 +1687,7 @@ extern const struct dev_pm_ops snd_soc_pm_ops;
 /* Helper functions */
 static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
 {
-	mutex_lock(&dapm->card->dapm_mutex);
+	mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
 }
 
 static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-30 18:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-29 16:25 [PATCH 1/2] ASoC: Use nested lock for snd_soc_dapm_mutex_lock Charles Keepax
2015-12-29 16:25 ` [PATCH 2/2] ASoC: wm5110: Use helper function to lock the DAPM mutex Charles Keepax
2015-12-30 18:05   ` Applied "ASoC: wm5110: Use helper function to lock the DAPM mutex" to the asoc tree Mark Brown
2015-12-30 18:05 ` Applied "ASoC: Use nested lock for snd_soc_dapm_mutex_lock" " Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.