All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@zonque.org>
To: alsa-devel@alsa-project.org
Cc: linux-arm-msm@vger.kernel.org, broonie@kernel.org,
	srinivas.kandagatla@linaro.org, Daniel Mack <daniel@zonque.org>
Subject: [PATCH] ASoC: codecs: msm8916-wcd: use threaded IRQ handlers
Date: Fri, 20 Apr 2018 14:07:50 +0200	[thread overview]
Message-ID: <20180420120750.356-1-daniel@zonque.org> (raw)

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

             reply	other threads:[~2018-04-20 12:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-20 12:07 Daniel Mack [this message]
2018-04-23 14:49 ` [PATCH] ASoC: codecs: msm8916-wcd: use threaded IRQ handlers Mark Brown
2018-04-23 14:54   ` Daniel Mack
2018-04-23 15:25     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180420120750.356-1-daniel@zonque.org \
    --to=daniel@zonque.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.