Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1310589

[PATCH 4.2.y-ckt 301/305] ASoC: Use nested lock for snd_soc_dapm_mutex_lock

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Kamal Mostafa <kamal@canonical.com>
Newsgroups linux.kernel
Subject [PATCH 4.2.y-ckt 301/305] ASoC: Use nested lock for snd_soc_dapm_mutex_lock
Date Sat, 16 Jan 2016 01:20:02 +0100
Message-ID <qRmL0-54G-13@gated-at.bofh.it> (permalink)
References <qRmBj-507-3@gated-at.bofh.it>
X-Mailer git-send-email 1.9.1
X-Extended-Stable 4.2
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 42
Organization linux.* mail to news gateway
X-Original-Cc Charles Keepax <ckeepax@opensource.wolfsonmicro.com>, Mark Brown <broonie@kernel.org>, Kamal Mostafa <kamal@canonical.com>
X-Original-Date Fri, 15 Jan 2016 16:01:55 -0800
X-Original-Message-ID <1452902519-2754-302-git-send-email-kamal@canonical.com>
X-Original-References <1452902519-2754-1-git-send-email-kamal@canonical.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1310589

Show key headers only | View raw


4.2.8-ckt2 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

commit 783513eec3209542fcd6ac0cbcb030b3c17a4827 upstream.

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>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.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 334d0d2..78a58c1 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1629,7 +1629,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)
-- 
1.9.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 4.2.y-ckt 301/305] ASoC: Use nested lock for snd_soc_dapm_mutex_lock Kamal Mostafa <kamal@canonical.com> - 2016-01-16 01:20 +0100

csiph-web