diff mbox series

rtc: st-lpc: Use IRQF_NO_AUTOEN flag in request_irq()

Message ID 20240912033727.3013951-1-ruanjinjie@huawei.com (mailing list archive)
State New, archived
Headers show
Series rtc: st-lpc: Use IRQF_NO_AUTOEN flag in request_irq() | expand

Commit Message

Jinjie Ruan Sept. 12, 2024, 3:37 a.m. UTC
If request_irq() fails in st_rtc_probe(), there is no need to enable
the irq, and if it succeeds, 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: b5b2bdfc2893 ("rtc: st: Add new driver for ST's LPC RTC")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/rtc/rtc-st-lpc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Alexandre Belloni Nov. 10, 2024, 10:06 p.m. UTC | #1
On Thu, 12 Sep 2024 11:37:27 +0800, Jinjie Ruan wrote:
> If request_irq() fails in st_rtc_probe(), there is no need to enable
> the irq, and if it succeeds, 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] rtc: st-lpc: Use IRQF_NO_AUTOEN flag in request_irq()
      https://git.kernel.org/abelloni/c/b6cd7adec0cf

Best regards,
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-st-lpc.c b/drivers/rtc/rtc-st-lpc.c
index d492a2d26600..c6d4522411b3 100644
--- a/drivers/rtc/rtc-st-lpc.c
+++ b/drivers/rtc/rtc-st-lpc.c
@@ -218,15 +218,14 @@  static int st_rtc_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	ret = devm_request_irq(&pdev->dev, rtc->irq, st_rtc_handler, 0,
-			       pdev->name, rtc);
+	ret = devm_request_irq(&pdev->dev, rtc->irq, st_rtc_handler,
+			       IRQF_NO_AUTOEN, pdev->name, rtc);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to request irq %i\n", rtc->irq);
 		return ret;
 	}
 
 	enable_irq_wake(rtc->irq);
-	disable_irq(rtc->irq);
 
 	rtc->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(rtc->clk))