diff mbox series

remoteproc: ingenic: Request IRQ disabled

Message ID 20211205111349.51213-1-lars@metafoo.de (mailing list archive)
State Accepted
Headers show
Series remoteproc: ingenic: Request IRQ disabled | expand

Commit Message

Lars-Peter Clausen Dec. 5, 2021, 11:13 a.m. UTC
The ingenic remoteproc driver requests its IRQ and then immediately
disables it.

The disable is necessary since irq_request() normally enables the IRQ. But
there is a new flag IRQF_NO_AUTOEN that when specified keeps the IRQ
disabled. Use this new flag rather than calling disable_irq().

This slightly reduce the boilerplate code and also avoids a theoretical
race condition where the IRQ could fire between irq_request() and
disable_irq().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/remoteproc/ingenic_rproc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Paul Cercueil Dec. 6, 2021, 4:01 p.m. UTC | #1
Hi Lars,

Le dim., déc. 5 2021 at 12:13:49 +0100, Lars-Peter Clausen 
<lars@metafoo.de> a écrit :
> The ingenic remoteproc driver requests its IRQ and then immediately
> disables it.
> 
> The disable is necessary since irq_request() normally enables the 
> IRQ. But
> there is a new flag IRQF_NO_AUTOEN that when specified keeps the IRQ
> disabled. Use this new flag rather than calling disable_irq().
> 
> This slightly reduce the boilerplate code and also avoids a 
> theoretical
> race condition where the IRQ could fire between irq_request() and
> disable_irq().
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

Acked-by: Paul Cercueil <paul@crapouillou.net>

Cheers,
-Paul

> ---
>  drivers/remoteproc/ingenic_rproc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/remoteproc/ingenic_rproc.c 
> b/drivers/remoteproc/ingenic_rproc.c
> index a356738160a4..9902cce28692 100644
> --- a/drivers/remoteproc/ingenic_rproc.c
> +++ b/drivers/remoteproc/ingenic_rproc.c
> @@ -218,14 +218,13 @@ static int ingenic_rproc_probe(struct 
> platform_device *pdev)
>  	if (vpu->irq < 0)
>  		return vpu->irq;
> 
> -	ret = devm_request_irq(dev, vpu->irq, vpu_interrupt, 0, "VPU", 
> rproc);
> +	ret = devm_request_irq(dev, vpu->irq, vpu_interrupt, IRQF_NO_AUTOEN,
> +			       "VPU", rproc);
>  	if (ret < 0) {
>  		dev_err(dev, "Failed to request IRQ\n");
>  		return ret;
>  	}
> 
> -	disable_irq(vpu->irq);
> -
>  	ret = devm_rproc_add(dev, rproc);
>  	if (ret) {
>  		dev_err(dev, "Failed to register remote processor\n");
> --
> 2.30.2
>
Mathieu Poirier Dec. 6, 2021, 5:22 p.m. UTC | #2
On Sun, Dec 05, 2021 at 12:13:49PM +0100, Lars-Peter Clausen wrote:
> The ingenic remoteproc driver requests its IRQ and then immediately
> disables it.
> 
> The disable is necessary since irq_request() normally enables the IRQ. But
> there is a new flag IRQF_NO_AUTOEN that when specified keeps the IRQ
> disabled. Use this new flag rather than calling disable_irq().
> 
> This slightly reduce the boilerplate code and also avoids a theoretical
> race condition where the IRQ could fire between irq_request() and
> disable_irq().
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
>  drivers/remoteproc/ingenic_rproc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/remoteproc/ingenic_rproc.c b/drivers/remoteproc/ingenic_rproc.c
> index a356738160a4..9902cce28692 100644
> --- a/drivers/remoteproc/ingenic_rproc.c
> +++ b/drivers/remoteproc/ingenic_rproc.c
> @@ -218,14 +218,13 @@ static int ingenic_rproc_probe(struct platform_device *pdev)
>  	if (vpu->irq < 0)
>  		return vpu->irq;
>  
> -	ret = devm_request_irq(dev, vpu->irq, vpu_interrupt, 0, "VPU", rproc);
> +	ret = devm_request_irq(dev, vpu->irq, vpu_interrupt, IRQF_NO_AUTOEN,
> +			       "VPU", rproc);
>  	if (ret < 0) {
>  		dev_err(dev, "Failed to request IRQ\n");
>  		return ret;
>  	}
>  
> -	disable_irq(vpu->irq);
> -

I have applied this patch.

Thanks,
Mathieu

>  	ret = devm_rproc_add(dev, rproc);
>  	if (ret) {
>  		dev_err(dev, "Failed to register remote processor\n");
> -- 
> 2.30.2
>
diff mbox series

Patch

diff --git a/drivers/remoteproc/ingenic_rproc.c b/drivers/remoteproc/ingenic_rproc.c
index a356738160a4..9902cce28692 100644
--- a/drivers/remoteproc/ingenic_rproc.c
+++ b/drivers/remoteproc/ingenic_rproc.c
@@ -218,14 +218,13 @@  static int ingenic_rproc_probe(struct platform_device *pdev)
 	if (vpu->irq < 0)
 		return vpu->irq;
 
-	ret = devm_request_irq(dev, vpu->irq, vpu_interrupt, 0, "VPU", rproc);
+	ret = devm_request_irq(dev, vpu->irq, vpu_interrupt, IRQF_NO_AUTOEN,
+			       "VPU", rproc);
 	if (ret < 0) {
 		dev_err(dev, "Failed to request IRQ\n");
 		return ret;
 	}
 
-	disable_irq(vpu->irq);
-
 	ret = devm_rproc_add(dev, rproc);
 	if (ret) {
 		dev_err(dev, "Failed to register remote processor\n");