From patchwork Fri Apr 20 12:07:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 10352511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D029D6023A for ; Fri, 20 Apr 2018 12:08:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF4002866C for ; Fri, 20 Apr 2018 12:08:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3B3D286F6; Fri, 20 Apr 2018 12:08:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F14BF2866C for ; Fri, 20 Apr 2018 12:08:07 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DBD302673D8; Fri, 20 Apr 2018 14:08:03 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3BD572673DF; Fri, 20 Apr 2018 14:08:01 +0200 (CEST) Received: from mail.bugwerft.de (mail.bugwerft.de [46.23.86.59]) by alsa0.perex.cz (Postfix) with ESMTP id 202972673D4 for ; Fri, 20 Apr 2018 14:07:57 +0200 (CEST) Received: from localhost.localdomain (mue-88-130-49-099.dsl.tropolys.de [88.130.49.99]) by mail.bugwerft.de (Postfix) with ESMTPSA id 41D372891E4; Fri, 20 Apr 2018 12:05:58 +0000 (UTC) From: Daniel Mack To: alsa-devel@alsa-project.org Date: Fri, 20 Apr 2018 14:07:50 +0200 Message-Id: <20180420120750.356-1-daniel@zonque.org> X-Mailer: git-send-email 2.14.3 Cc: linux-arm-msm@vger.kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, Daniel Mack Subject: [alsa-devel] [PATCH] ASoC: codecs: msm8916-wcd: use threaded IRQ handlers X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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");