]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.16.3/asoc-wm8994-prevent-double-lock-of-accdet_lock-mutex-on-wm1811.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.16.3 / asoc-wm8994-prevent-double-lock-of-accdet_lock-mutex-on-wm1811.patch
1 From b38314179c9ccb789e6fe967cff171fa817e8978 Mon Sep 17 00:00:00 2001
2 From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
3 Date: Mon, 16 Jun 2014 21:24:03 +0100
4 Subject: ASoC: wm8994: Prevent double lock of accdet_lock mutex on wm1811
5
6 From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
7
8 commit b38314179c9ccb789e6fe967cff171fa817e8978 upstream.
9
10 wm1811_micd_stop takes the accdet_lock mutex, and is called from two
11 places, one of which is already holding the accdet_lock. This obviously
12 causes a lock up.
13
14 This patch fixes this issue by removing the lock from wm1811_micd_stop
15 and ensuring that it is always locked externally.
16
17 Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
18 Signed-off-by: Mark Brown <broonie@linaro.org>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21 ---
22 sound/soc/codecs/wm8994.c | 9 +++------
23 1 file changed, 3 insertions(+), 6 deletions(-)
24
25 --- a/sound/soc/codecs/wm8994.c
26 +++ b/sound/soc/codecs/wm8994.c
27 @@ -3505,6 +3505,7 @@ static irqreturn_t wm8994_mic_irq(int ir
28 return IRQ_HANDLED;
29 }
30
31 +/* Should be called with accdet_lock held */
32 static void wm1811_micd_stop(struct snd_soc_codec *codec)
33 {
34 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
35 @@ -3512,14 +3513,10 @@ static void wm1811_micd_stop(struct snd_
36 if (!wm8994->jackdet)
37 return;
38
39 - mutex_lock(&wm8994->accdet_lock);
40 -
41 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, WM8958_MICD_ENA, 0);
42
43 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK);
44
45 - mutex_unlock(&wm8994->accdet_lock);
46 -
47 if (wm8994->wm8994->pdata.jd_ext_cap)
48 snd_soc_dapm_disable_pin(&codec->dapm,
49 "MICBIAS2");
50 @@ -3560,10 +3557,10 @@ static void wm8958_open_circuit_work(str
51 open_circuit_work.work);
52 struct device *dev = wm8994->wm8994->dev;
53
54 - wm1811_micd_stop(wm8994->hubs.codec);
55 -
56 mutex_lock(&wm8994->accdet_lock);
57
58 + wm1811_micd_stop(wm8994->hubs.codec);
59 +
60 dev_dbg(dev, "Reporting open circuit\n");
61
62 wm8994->jack_mic = false;