rtc: st-lpc: get IRQ via platform_get_irq()
authorRosen Penev <rosenp@gmail.com>
Tue, 14 Jul 2026 00:22:59 +0000 (17:22 -0700)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 19 Aug 2026 16:17:03 +0000 (18:17 +0200)
Replace irq_of_parse_and_map() with platform_get_irq(), which resolves
the interrupt from pdev->dev.of_node directly and returns a positive IRQ
or a negative errno (it never returns 0). Propagate the error on failure
instead of the previous open-coded "IRQ missing or invalid" / -EINVAL
message, so -EPROBE_DEFER is handled correctly. The rtc->irq field is a
signed short, so the negative error code is preserved.

np is still used by of_property_read_u32() for "st,lpc-mode", so it is
not removed.

Built for ARM (multi_v7_defconfig + CONFIG_RTC_DRV_ST_LPC) with LLVM=1;
drivers/rtc/rtc-st-lpc.o compiles cleanly.

Assisted-by: opencode:hy3-free
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Link: https://patch.msgid.link/20260714002259.1392655-1-rosenp@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-st-lpc.c

index c6d4522..ae79ddf 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <linux/of_irq.h>
 #include <linux/platform_device.h>
 #include <linux/rtc.h>
 
@@ -212,11 +211,9 @@ static int st_rtc_probe(struct platform_device *pdev)
        if (IS_ERR(rtc->ioaddr))
                return PTR_ERR(rtc->ioaddr);
 
-       rtc->irq = irq_of_parse_and_map(np, 0);
-       if (!rtc->irq) {
-               dev_err(&pdev->dev, "IRQ missing or invalid\n");
-               return -EINVAL;
-       }
+       rtc->irq = platform_get_irq(pdev, 0);
+       if (rtc->irq < 0)
+               return rtc->irq;
 
        ret = devm_request_irq(&pdev->dev, rtc->irq, st_rtc_handler,
                               IRQF_NO_AUTOEN, pdev->name, rtc);