linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@somainline.org>
To: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	mazziesaccount@gmail.com
Cc: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] regulator: qcom-labibb: Use disable_irq_nosync from isr
Date: Tue, 2 Feb 2021 15:36:17 +0100	[thread overview]
Message-ID: <1d37a36c-f82b-726a-6edb-866b087aeef8@somainline.org> (raw)
In-Reply-To: <f2c4c88d90bf7473e1b84b8a99b7b33d7a081764.1612249657.git.matti.vaittinen@fi.rohmeurope.com>

Il 02/02/21 08:37, Matti Vaittinen ha scritto:
> 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.
> 

It didn't deadlock, but looking at it again -- oh my, I agree with you.

Reviewed-by: AngeloGioacchino Del Regno 
<angelogioacchino.delregno@somainline.org>

> Fixes: 390af53e04114 ("regulator: qcom-labibb: Implement short-circuit and over-current IRQs")
> 
> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> ---
> 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,
> 


  reply	other threads:[~2021-02-02 14:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02  7:36 [PATCH 1/2] regulator: qcom-labibb: avoid unbalanced IRQ enable Matti Vaittinen
2021-02-02  7:37 ` [PATCH 2/2] regulator: qcom-labibb: Use disable_irq_nosync from isr Matti Vaittinen
2021-02-02 14:36   ` AngeloGioacchino Del Regno [this message]
2021-02-02 14:42 ` [PATCH 1/2] regulator: qcom-labibb: avoid unbalanced IRQ enable AngeloGioacchino Del Regno
2021-02-03  6:15   ` Matti Vaittinen
2021-02-02 16:32 ` (subset) " 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=1d37a36c-f82b-726a-6edb-866b087aeef8@somainline.org \
    --to=angelogioacchino.delregno@somainline.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=mazziesaccount@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).