Skip to contentSkip to conversation

remoteproc: ingenic: Request IRQ disabled

PATCH In review Lars-Peter Clausen 3 participants 3 messages Dec 5, 2021 – Dec 6, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remoteproc: ingenic: Request IRQ disabled

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().

---
 drivers/remoteproc/ingenic_rproc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/remoteproc/ingenic_rproc.c +2 -3
index a356738160a4..9902cce28692 100644
@@ -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");
Signature · 1 line
2.30.2
maintainer Acked-by on v1 1/1
#1 lore raw

Hi Lars,

Quoted 7 lines · Lars-Peter Clausen

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().

Quoted 5 lines

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

Cheers,
-Paul

Quoted 30 lines
---
 drivers/remoteproc/ingenic_rproc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/remoteproc/ingenic_rproc.c +2 -3
index a356738160a4..9902cce28692 100644
@@ -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);
drivers/remoteproc/ingenic_rproc.c +0 -1
 	if (ret) {
 		dev_err(dev, "Failed to register remote processor\n");
--

2.30.2

maintainer
#2 lore raw
In reply to Lars-Peter Clausen
Quoted 24 lines · Lars-Peter Clausen

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().

---
 drivers/remoteproc/ingenic_rproc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/remoteproc/ingenic_rproc.c +0 -0
index a356738160a4..9902cce28692 100644
@@ -218,14 +218,13 @@ static int ingenic_rproc_probe(struct platform_device *pdev)
 	if (vpu->irq < 0)
 		return vpu->irq;
 

drivers/remoteproc/ingenic_rproc.c static int ingenic_rproc_probe(struct platform_device *pdev) · line 228

Quoted 10 lines
drivers/remoteproc/ingenic_rproc.c +2 -3
-	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

Quoted 6 lines
drivers/remoteproc/ingenic_rproc.c +0 -0
 	ret = devm_rproc_add(dev, rproc);
 	if (ret) {
 		dev_err(dev, "Failed to register remote processor\n");
Signature · 1 line
2.30.2