From patchwork Tue Feb 2 07:37:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 12060917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B96D0C433DB for ; Tue, 2 Feb 2021 07:38:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7306D64E8D for ; Tue, 2 Feb 2021 07:38:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231358AbhBBHiw (ORCPT ); Tue, 2 Feb 2021 02:38:52 -0500 Received: from mail-lj1-f174.google.com ([209.85.208.174]:39241 "EHLO mail-lj1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232202AbhBBHir (ORCPT ); Tue, 2 Feb 2021 02:38:47 -0500 Received: by mail-lj1-f174.google.com with SMTP id u4so21291843ljh.6; Mon, 01 Feb 2021 23:38:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RCsq0lQnyJowuaLECngen64lS6PLCnkwIXsedpi2nHs=; b=XHfeht+h8FlBQPYqUlIn2vfVddgSGqQe2BKRNlTRxS29XZD0xN4kC4P7VxDFCjZjAr q/SFnxQH3TJIZgl1OegamEmbcVAn9+exiYhb6gkL13vnUT3WF2dQ06zR5OP9KwudaOYU SEAHSBfCu2WlAdQ+h1FdJdeypGRYoROtFiYrZZpbJ/k9GsXclRmiy2PNTG2NK7gbNLfN EwsdcyW9SkgoUs5Tk8QS95P9yRWhEf4+T1q1zvYK6cRmXPxnKissDzuRI9fE7/6aGJux PH8hwsZkMSCOOY8WwJ5SjyypV8g9+FGqaU8kWwjXordQtsrLYAU/jB3Qkp3BhFgJgZVh oG+w== X-Gm-Message-State: AOAM530k0GwVLZ35orXc8KWLIFty3kMTVbCssKH3crp72j9Bu6OoX6rs 6jqJhxBoBTQo/JxqhdAz60Q= X-Google-Smtp-Source: ABdhPJxtBkSx+nBB44/bwUk/mCPW67PLF2vhzRPzdifuoJj0sy1m5Sn4toDtTqwOYD8iB1+grRHtLw== X-Received: by 2002:a2e:7614:: with SMTP id r20mr12913905ljc.93.1612251485093; Mon, 01 Feb 2021 23:38:05 -0800 (PST) Received: from localhost.localdomain (62-78-225-252.bb.dnainternet.fi. [62.78.225.252]) by smtp.gmail.com with ESMTPSA id z14sm45830lfh.296.2021.02.01.23.38.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 23:38:04 -0800 (PST) Date: Tue, 2 Feb 2021 09:37:58 +0200 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Cc: Andy Gross , Bjorn Andersson , Liam Girdwood , Mark Brown , AngeloGioacchino Del Regno , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] regulator: qcom-labibb: Use disable_irq_nosync from isr Message-ID: References: <0400d7471571144bfeba27e3a80a24eb17d81f4d.1612249657.git.matti.vaittinen@fi.rohmeurope.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <0400d7471571144bfeba27e3a80a24eb17d81f4d.1612249657.git.matti.vaittinen@fi.rohmeurope.com> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Calling the disable_irq() from irq handler might be a bad idea as disable_irq() should wait for handlers to run. I don't see why this wouldn't deadlock in wait_event waiting for the threaded handler to complete. Use disable_irq_nosync() instead. Fixes: 390af53e04114 ("regulator: qcom-labibb: Implement short-circuit and over-current IRQs") Signed-off-by: Matti Vaittinen Reviewed-by: AngeloGioacchino Del Regno --- This fix is done purely based on code reading. No testing is done. I don't have the HW (and even if I did I might have hard time producing these errors) I have not tested this and I am unsure if my code-reading is correct => I would _really_ appreciate second opinion and/or testing drivers/regulator/qcom-labibb-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/qcom-labibb-regulator.c b/drivers/regulator/qcom-labibb-regulator.c index 5ac4566f9b7f..40e92670e307 100644 --- a/drivers/regulator/qcom-labibb-regulator.c +++ b/drivers/regulator/qcom-labibb-regulator.c @@ -283,7 +283,7 @@ static irqreturn_t qcom_labibb_ocp_isr(int irq, void *chip) * Disable the interrupt temporarily, or it will fire continuously; * we will re-enable it in the recovery worker function. */ - disable_irq(irq); + disable_irq_nosync(irq); /* Warn the user for overcurrent */ dev_warn(vreg->dev, "Over-Current interrupt fired!\n"); @@ -536,7 +536,7 @@ static irqreturn_t qcom_labibb_sc_isr(int irq, void *chip) * Disable the interrupt temporarily, or it will fire continuously; * we will re-enable it in the recovery worker function. */ - disable_irq(irq); + disable_irq_nosync(irq); /* Signal out of regulation event to drivers */ regulator_notifier_call_chain(vreg->rdev,