Re: [PATCH v1 4/8] ACPI: x86/rtc-cmos: Use platform device for driver binding
From: Rafael J. Wysocki
Date: Tue Mar 03 2026 - 07:52:17 EST
On Tuesday, March 3, 2026 7:07:52 AM CET Nathan Chancellor wrote:
> Hi Rafael,
>
> On Mon, Feb 23, 2026 at 04:30:21PM +0100, Rafael J. Wysocki wrote:
> > From: "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>
> >
> > Modify the rtc-cmos driver to bind to a platform device on systems with
> > ACPI via acpi_match_table and advertise the CMOST RTC ACPI device IDs
> > for driver auto-loading. Note that adding the requisite device IDs to
> > it and exposing them via MODULE_DEVICE_TABLE() is sufficient for this
> > purpose.
> >
> > Since the ACPI device IDs in question are the same as for the CMOS RTC
> > ACPI scan handler, put them into a common header file and use the
> > definition from there in both places.
> >
> > Additionally, to prevent a PNP device from being created for the CMOS
> > RTC if a platform one is present already, make is_cmos_rtc_device()
> > check cmos_rtc_platform_device_present introduced previously.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
>
> After this change in -next as commit 2a78e4210444 ("ACPI: x86/rtc-cmos:
> Use platform device for driver binding"), I am seeing
>
> rtc_cmos PNP0B00:00: error -ENXIO: IRQ index 0 not found
>
> on a few of my test machines. Is this expected?
Not really, thanks for reporting!
Please send me a dmesg boot log from one of the affected systems.
The patch below should make the message go away.
---
From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Subject: [PATCH v1] rtc: cmos: Use platform_get_irq_optional() in cmos_platform_probe()
The rtc-cmos driver can live without an IRQ and returning an error
code from platform_get_irq() is not a problem for it in general, so
make it call platform_get_irq_optional() in cmos_platform_probe()
instead of platform_get_irq() to avoid a confusing error message
printed by the latter if an IRQ cannot be found for IRQ index 0,
which is possible on x86 platforms.
Additionally, on x86, if the IRQ is not defined and the system has
a legacy PIC, hardcode it to RTC_IRQ, which should be safe then.
Fixes: 2a78e4210444 ("ACPI: x86/rtc-cmos: Use platform device for driver binding")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
drivers/rtc/rtc-cmos.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -1423,9 +1423,18 @@ static int __init cmos_platform_probe(st
resource = platform_get_resource(pdev, IORESOURCE_IO, 0);
else
resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- irq = platform_get_irq(pdev, 0);
- if (irq < 0)
+ irq = platform_get_irq_optional(pdev, 0);
+ if (irq < 0) {
irq = -1;
+#ifdef CONFIG_X86
+ /*
+ * On some x86 systems, the IRQ is not defined, but it should
+ * always be safe to hardcode it on systems with a legacy PIC.
+ */
+ if (nr_legacy_irqs())
+ irq = RTC_IRQ;
+#endif
+ }
return cmos_do_probe(&pdev->dev, resource, irq);
}