[PATCH] mfd: tps65010: Use IRQF_NO_AUTOEN flag in request_irq() to fix race

Jinjie Ruan posted 1 patch 3 weeks, 3 days ago
drivers/mfd/tps65010.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
[PATCH] mfd: tps65010: Use IRQF_NO_AUTOEN flag in request_irq() to fix race
Posted by Jinjie Ruan 3 weeks, 3 days ago
As the comment said, disable_irq() after request_irq() still has a
time gap in which interrupts can come. request_irq() with IRQF_NO_AUTOEN
flag will disable IRQ auto-enable when request IRQ.

Fixes: 72cd799544f2 ("[PATCH] I2C: add i2c driver for TPS6501x")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/mfd/tps65010.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
index 2b9105295f30..710364435b6b 100644
--- a/drivers/mfd/tps65010.c
+++ b/drivers/mfd/tps65010.c
@@ -544,17 +544,13 @@ static int tps65010_probe(struct i2c_client *client)
 	 */
 	if (client->irq > 0) {
 		status = request_irq(client->irq, tps65010_irq,
-				     IRQF_TRIGGER_FALLING, DRIVER_NAME, tps);
+				     IRQF_TRIGGER_FALLING | IRQF_NO_AUTOEN,
+				     DRIVER_NAME, tps);
 		if (status < 0) {
 			dev_dbg(&client->dev, "can't get IRQ %d, err %d\n",
 					client->irq, status);
 			return status;
 		}
-		/* annoying race here, ideally we'd have an option
-		 * to claim the irq now and enable it later.
-		 * FIXME genirq IRQF_NOAUTOEN now solves that ...
-		 */
-		disable_irq(client->irq);
 		set_bit(FLAG_IRQ_ENABLE, &tps->flags);
 	} else
 		dev_warn(&client->dev, "IRQ not configured!\n");
-- 
2.34.1
Re: (subset) [PATCH] mfd: tps65010: Use IRQF_NO_AUTOEN flag in request_irq() to fix race
Posted by Lee Jones 3 days, 18 hours ago
On Thu, 12 Sep 2024 11:15:30 +0800, Jinjie Ruan wrote:
> As the comment said, disable_irq() after request_irq() still has a
> time gap in which interrupts can come. request_irq() with IRQF_NO_AUTOEN
> flag will disable IRQ auto-enable when request IRQ.
> 
> 

Applied, thanks!

[1/1] mfd: tps65010: Use IRQF_NO_AUTOEN flag in request_irq() to fix race
      commit: f7efea4fcf4b9f5d48e690f4f327bafbabcb953f

--
Lee Jones [李琼斯]