From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
x86 Maintainers <x86@kernel.org>,
linux-rtc@vger.kernel.org
Subject: Re: [PATCH v1 7/8] rtc: cmos: Drop PNP device support
Date: Thu, 26 Feb 2026 14:02:20 +0100 [thread overview]
Message-ID: <20260226130220deafa22a@mail.local> (raw)
In-Reply-To: <2355012.iZASKD2KPV@rafael.j.wysocki>
On 23/02/2026 16:32:29+0100, Rafael J. Wysocki wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
>
> Previous changes effectively prevented PNP devices from being created
> for the CMOS RTC on x86 with ACPI.
>
> Although in principle a CMOS RTC PNP device may exist on an x86 system
> without ACPI (that is, an x86 system where there is no ACPI at all, not
> one booted with ACPI disabled), such systems were there in the field ~30
> years ago and most likely they would not be able to run a contemporary
> Linux kernel.
>
> For the above reasons, drop the PNP device support from the rtc-cmos
> driver.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
> drivers/rtc/rtc-cmos.c | 113 +++--------------------------------------
> 1 file changed, 8 insertions(+), 105 deletions(-)
>
> diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
> index 7457f42fd6f0..9ac5bab846c1 100644
> --- a/drivers/rtc/rtc-cmos.c
> +++ b/drivers/rtc/rtc-cmos.c
> @@ -1370,85 +1370,6 @@ static int __maybe_unused cmos_resume(struct device *dev)
>
> static SIMPLE_DEV_PM_OPS(cmos_pm_ops, cmos_suspend, cmos_resume);
>
> -/*----------------------------------------------------------------*/
> -
> -/* On non-x86 systems, a "CMOS" RTC lives most naturally on platform_bus.
> - * ACPI systems always list these as PNPACPI devices, and pre-ACPI PCs
> - * probably list them in similar PNPBIOS tables; so PNP is more common.
> - *
> - * We don't use legacy "poke at the hardware" probing. Ancient PCs that
> - * predate even PNPBIOS should set up platform_bus devices.
> - */
> -
> -#ifdef CONFIG_PNP
> -
> -#include <linux/pnp.h>
> -
> -static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
> -{
> - int irq;
> -
> - if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) {
> - irq = 0;
> -#ifdef CONFIG_X86
> - /* Some machines contain a PNP entry for the RTC, but
> - * don't define the IRQ. It should always be safe to
> - * hardcode it on systems with a legacy PIC.
> - */
> - if (nr_legacy_irqs())
> - irq = RTC_IRQ;
> -#endif
> - } else {
> - irq = pnp_irq(pnp, 0);
> - }
> -
> - return cmos_do_probe(&pnp->dev, pnp_get_resource(pnp, IORESOURCE_IO, 0), irq);
> -}
> -
> -static void cmos_pnp_remove(struct pnp_dev *pnp)
> -{
> - cmos_do_remove(&pnp->dev);
> -}
> -
> -static void cmos_pnp_shutdown(struct pnp_dev *pnp)
> -{
> - struct device *dev = &pnp->dev;
> - struct cmos_rtc *cmos = dev_get_drvdata(dev);
> -
> - if (system_state == SYSTEM_POWER_OFF) {
> - int retval = cmos_poweroff(dev);
> -
> - if (cmos_aie_poweroff(dev) < 0 && !retval)
> - return;
> - }
> -
> - cmos_do_shutdown(cmos->irq);
> -}
> -
> -static const struct pnp_device_id rtc_ids[] = {
> - { .id = "PNP0b00", },
> - { .id = "PNP0b01", },
> - { .id = "PNP0b02", },
> - { },
> -};
> -MODULE_DEVICE_TABLE(pnp, rtc_ids);
> -
> -static struct pnp_driver cmos_pnp_driver = {
> - .name = driver_name,
> - .id_table = rtc_ids,
> - .probe = cmos_pnp_probe,
> - .remove = cmos_pnp_remove,
> - .shutdown = cmos_pnp_shutdown,
> -
> - /* flag ensures resume() gets called, and stops syslog spam */
> - .flags = PNP_DRIVER_RES_DO_NOT_CHANGE,
> - .driver = {
> - .pm = &cmos_pm_ops,
> - },
> -};
> -
> -#endif /* CONFIG_PNP */
> -
> #ifdef CONFIG_OF
> static const struct of_device_id of_cmos_match[] = {
> {
> @@ -1543,45 +1464,27 @@ static struct platform_driver cmos_platform_driver = {
> }
> };
>
> -#ifdef CONFIG_PNP
> -static bool pnp_driver_registered;
> -#endif
> static bool platform_driver_registered;
>
> static int __init cmos_init(void)
> {
> - int retval = 0;
> + int retval;
>
> -#ifdef CONFIG_PNP
> - retval = pnp_register_driver(&cmos_pnp_driver);
> - if (retval == 0)
> - pnp_driver_registered = true;
> -#endif
> + if (cmos_rtc.dev)
> + return 0;
>
> - if (!cmos_rtc.dev) {
> - retval = platform_driver_probe(&cmos_platform_driver,
> - cmos_platform_probe);
> - if (retval == 0)
> - platform_driver_registered = true;
> - }
> + retval = platform_driver_probe(&cmos_platform_driver, cmos_platform_probe);
> + if (retval)
> + return retval;
>
> - if (retval == 0)
> - return 0;
> + platform_driver_registered = true;
>
> -#ifdef CONFIG_PNP
> - if (pnp_driver_registered)
> - pnp_unregister_driver(&cmos_pnp_driver);
> -#endif
> - return retval;
> + return 0;
> }
> module_init(cmos_init);
>
> static void __exit cmos_exit(void)
> {
> -#ifdef CONFIG_PNP
> - if (pnp_driver_registered)
> - pnp_unregister_driver(&cmos_pnp_driver);
> -#endif
> if (platform_driver_registered)
> platform_driver_unregister(&cmos_platform_driver);
> }
> --
> 2.51.0
>
>
>
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2026-02-26 13:02 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 15:27 [PATCH v1 0/8] ACPI: x86/rtc-cmos: Bind rtc-cmos to platform devices Rafael J. Wysocki
2026-02-23 15:28 ` [PATCH v1 1/8] ACPI: x86: cmos_rtc: Clean up address space handler driver Rafael J. Wysocki
2026-02-23 15:28 ` [PATCH v1 2/8] ACPI: x86: cmos_rtc: Improve coordination with ACPI TAD driver Rafael J. Wysocki
2026-02-23 15:29 ` [PATCH v1 3/8] ACPI: x86: cmos_rtc: Create a CMOS RTC platform device Rafael J. Wysocki
2026-02-25 18:01 ` Dave Hansen
2026-02-23 15:30 ` [PATCH v1 4/8] ACPI: x86/rtc-cmos: Use platform device for driver binding Rafael J. Wysocki
2026-02-26 13:01 ` Alexandre Belloni
2026-03-03 6:07 ` Nathan Chancellor
2026-03-03 12:51 ` Rafael J. Wysocki
2026-03-03 17:52 ` Nathan Chancellor
2026-03-03 18:47 ` Rafael J. Wysocki
2026-03-03 21:17 ` Nathan Chancellor
2026-03-04 12:42 ` Rafael J. Wysocki
2026-02-23 15:31 ` [PATCH v1 5/8] ACPI: PNP: Drop CMOS RTC PNP device support Rafael J. Wysocki
2026-02-23 15:31 ` [PATCH v1 6/8] x86: rtc: Drop PNP device check Rafael J. Wysocki
2026-02-25 18:01 ` Dave Hansen
2026-02-25 18:10 ` Rafael J. Wysocki
2026-02-23 15:32 ` [PATCH v1 7/8] rtc: cmos: Drop PNP device support Rafael J. Wysocki
2026-02-26 13:02 ` Alexandre Belloni [this message]
2026-02-23 15:33 ` [PATCH v1 8/8] ACPI: TAD/x86: cmos_rtc: Consolidate address space handler setup Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260226130220deafa22a@mail.local \
--to=alexandre.belloni@bootlin.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox