* [PATCH] ASoC: codecs: msm8916-wcd: use threaded IRQ handlers
@ 2018-04-20 12:07 Daniel Mack
2018-04-23 14:49 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Mack @ 2018-04-20 12:07 UTC (permalink / raw)
To: alsa-devel; +Cc: linux-arm-msm, broonie, srinivas.kandagatla, Daniel Mack
The handler for the mbhc switch irq calls into snd_soc_jack_report() which
in turn triggers a notifier chain that is blocking, which means it allows
its callbacks to sleep. This leads to a "scheduling while atomic" Ooops
when the jack notifier callback uses snd_soc_dapm_sync(), for instance.
Fix this by switching from atomic to threaded IRQ handlers.
Fixes: de66b3455023e ("ASoC: codecs: msm8916-wcd-analog: add MBHC support")
Signed-off-by: Daniel Mack <daniel@zonque.org>
---
sound/soc/codecs/msm8916-wcd-analog.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c
index 12ee83d52405..52b4b6d836a4 100644
--- a/sound/soc/codecs/msm8916-wcd-analog.c
+++ b/sound/soc/codecs/msm8916-wcd-analog.c
@@ -1187,10 +1187,12 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
return irq;
}
- ret = devm_request_irq(dev, irq, pm8916_mbhc_switch_irq_handler,
- IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
- IRQF_ONESHOT,
- "mbhc switch irq", priv);
+ ret = devm_request_threaded_irq(dev, irq, NULL,
+ pm8916_mbhc_switch_irq_handler,
+ IRQF_TRIGGER_RISING |
+ IRQF_TRIGGER_FALLING |
+ IRQF_ONESHOT,
+ "mbhc switch irq", priv);
if (ret)
dev_err(dev, "cannot request mbhc switch irq\n");
@@ -1201,10 +1203,12 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
return irq;
}
- ret = devm_request_irq(dev, irq, mbhc_btn_press_irq_handler,
- IRQF_TRIGGER_RISING |
- IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
- "mbhc btn press irq", priv);
+ ret = devm_request_threaded_irq(dev, irq, NULL,
+ mbhc_btn_press_irq_handler,
+ IRQF_TRIGGER_RISING |
+ IRQF_TRIGGER_FALLING |
+ IRQF_ONESHOT,
+ "mbhc btn press irq", priv);
if (ret)
dev_err(dev, "cannot request mbhc button press irq\n");
@@ -1214,10 +1218,11 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
return irq;
}
- ret = devm_request_irq(dev, irq, mbhc_btn_release_irq_handler,
- IRQF_TRIGGER_RISING |
- IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
- "mbhc btn release irq", priv);
+ ret = devm_request_threaded_irq(dev, irq, NULL,
+ mbhc_btn_release_irq_handler,
+ IRQF_TRIGGER_RISING |
+ IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+ "mbhc btn release irq", priv);
if (ret)
dev_err(dev, "cannot request mbhc button release irq\n");
--
2.14.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: codecs: msm8916-wcd: use threaded IRQ handlers
2018-04-20 12:07 [PATCH] ASoC: codecs: msm8916-wcd: use threaded IRQ handlers Daniel Mack
@ 2018-04-23 14:49 ` Mark Brown
2018-04-23 14:54 ` Daniel Mack
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2018-04-23 14:49 UTC (permalink / raw)
To: Daniel Mack; +Cc: linux-arm-msm, alsa-devel, srinivas.kandagatla
[-- Attachment #1.1: Type: text/plain, Size: 431 bytes --]
On Fri, Apr 20, 2018 at 02:07:50PM +0200, Daniel Mack wrote:
> The handler for the mbhc switch irq calls into snd_soc_jack_report() which
> in turn triggers a notifier chain that is blocking, which means it allows
> its callbacks to sleep. This leads to a "scheduling while atomic" Ooops
> when the jack notifier callback uses snd_soc_dapm_sync(), for instance.
Someone already submitted a fix for this which is in -next already?
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: codecs: msm8916-wcd: use threaded IRQ handlers
2018-04-23 14:49 ` Mark Brown
@ 2018-04-23 14:54 ` Daniel Mack
2018-04-23 15:25 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Mack @ 2018-04-23 14:54 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-arm-msm, alsa-devel, srinivas.kandagatla
On Monday, April 23, 2018 04:49 PM, Mark Brown wrote:
> On Fri, Apr 20, 2018 at 02:07:50PM +0200, Daniel Mack wrote:
>> The handler for the mbhc switch irq calls into snd_soc_jack_report() which
>> in turn triggers a notifier chain that is blocking, which means it allows
>> its callbacks to sleep. This leads to a "scheduling while atomic" Ooops
>> when the jack notifier callback uses snd_soc_dapm_sync(), for instance.
>
> Someone already submitted a fix for this which is in -next already?
Ah, missed that. Nice, it's the exact same fix :)
Sorry for the noise,
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: codecs: msm8916-wcd: use threaded IRQ handlers
2018-04-23 14:54 ` Daniel Mack
@ 2018-04-23 15:25 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2018-04-23 15:25 UTC (permalink / raw)
To: Daniel Mack; +Cc: linux-arm-msm, alsa-devel, srinivas.kandagatla
[-- Attachment #1.1: Type: text/plain, Size: 270 bytes --]
On Mon, Apr 23, 2018 at 04:54:22PM +0200, Daniel Mack wrote:
> On Monday, April 23, 2018 04:49 PM, Mark Brown wrote:
> > Someone already submitted a fix for this which is in -next already?
> Ah, missed that. Nice, it's the exact same fix :)
Great minds and all that!
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-04-23 15:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-20 12:07 [PATCH] ASoC: codecs: msm8916-wcd: use threaded IRQ handlers Daniel Mack
2018-04-23 14:49 ` Mark Brown
2018-04-23 14:54 ` Daniel Mack
2018-04-23 15:25 ` 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.