Not really needed as no one unloads this driver in older kernels.
+++ /dev/null
-From 114464e7777f95d483ca293ad4ad8290a994df62 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 9 Nov 2022 13:07:08 +0100
-Subject: rtc: cmos: Call cmos_wake_setup() from cmos_do_probe()
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit 508ccdfb86b21da37ad091003a4d4567709d5dfb ]
-
-Notice that cmos_wake_setup() is the only user of acpi_rtc_info and it
-can operate on the cmos_rtc variable directly, so it need not set the
-platform_data pointer before cmos_do_probe() is called. Instead, it
-can be called by cmos_do_probe() in the case when the platform_data
-pointer is not set to implement the default behavior (which is to use
-the FADT information as long as ACPI support is enabled).
-
-Modify the code accordingly.
-
-While at it, drop a comment that doesn't really match the code it is
-supposed to be describing.
-
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Zhang Rui <rui.zhang@intel.com>
-Tested-by: Zhang Rui <rui.zhang@intel.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/4803444.31r3eYUQgx@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 47 ++++++++++++++++++++----------------------
- 1 file changed, 22 insertions(+), 25 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index e83b976b9abe..c51f6450daf2 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -702,6 +702,8 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
- return IRQ_NONE;
- }
-
-+static void cmos_wake_setup(struct device *dev);
-+
- #ifdef CONFIG_PNP
- #define INITSECTION
-
-@@ -785,19 +787,27 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
- if (info->address_space)
- address_space = info->address_space;
-
-- if (info->rtc_day_alarm && info->rtc_day_alarm < 128)
-- cmos_rtc.day_alrm = info->rtc_day_alarm;
-- if (info->rtc_mon_alarm && info->rtc_mon_alarm < 128)
-- cmos_rtc.mon_alrm = info->rtc_mon_alarm;
-- if (info->rtc_century && info->rtc_century < 128)
-- cmos_rtc.century = info->rtc_century;
-+ cmos_rtc.day_alrm = info->rtc_day_alarm;
-+ cmos_rtc.mon_alrm = info->rtc_mon_alarm;
-+ cmos_rtc.century = info->rtc_century;
-
- if (info->wake_on && info->wake_off) {
- cmos_rtc.wake_on = info->wake_on;
- cmos_rtc.wake_off = info->wake_off;
- }
-+ } else {
-+ cmos_wake_setup(dev);
- }
-
-+ if (cmos_rtc.day_alrm >= 128)
-+ cmos_rtc.day_alrm = 0;
-+
-+ if (cmos_rtc.mon_alrm >= 128)
-+ cmos_rtc.mon_alrm = 0;
-+
-+ if (cmos_rtc.century >= 128)
-+ cmos_rtc.century = 0;
-+
- cmos_rtc.dev = dev;
- dev_set_drvdata(dev, &cmos_rtc);
-
-@@ -1222,13 +1232,6 @@ static void use_acpi_alarm_quirks(void)
- static inline void use_acpi_alarm_quirks(void) { }
- #endif
-
--/* Every ACPI platform has a mc146818 compatible "cmos rtc". Here we find
-- * its device node and pass extra config data. This helps its driver use
-- * capabilities that the now-obsolete mc146818 didn't have, and informs it
-- * that this board's RTC is wakeup-capable (per ACPI spec).
-- */
--static struct cmos_rtc_board_info acpi_rtc_info;
--
- static void cmos_wake_setup(struct device *dev)
- {
- if (acpi_disabled)
-@@ -1236,26 +1239,23 @@ static void cmos_wake_setup(struct device *dev)
-
- use_acpi_alarm_quirks();
-
-- acpi_rtc_info.wake_on = rtc_wake_on;
-- acpi_rtc_info.wake_off = rtc_wake_off;
-+ cmos_rtc.wake_on = rtc_wake_on;
-+ cmos_rtc.wake_off = rtc_wake_off;
-
-- /* workaround bug in some ACPI tables */
-+ /* ACPI tables bug workaround. */
- if (acpi_gbl_FADT.month_alarm && !acpi_gbl_FADT.day_alarm) {
- dev_dbg(dev, "bogus FADT month_alarm (%d)\n",
- acpi_gbl_FADT.month_alarm);
- acpi_gbl_FADT.month_alarm = 0;
- }
-
-- acpi_rtc_info.rtc_day_alarm = acpi_gbl_FADT.day_alarm;
-- acpi_rtc_info.rtc_mon_alarm = acpi_gbl_FADT.month_alarm;
-- acpi_rtc_info.rtc_century = acpi_gbl_FADT.century;
-+ cmos_rtc.day_alrm = acpi_gbl_FADT.day_alarm;
-+ cmos_rtc.mon_alrm = acpi_gbl_FADT.month_alarm;
-+ cmos_rtc.century = acpi_gbl_FADT.century;
-
-- /* NOTE: S4_RTC_WAKE is NOT currently useful to Linux */
- if (acpi_gbl_FADT.flags & ACPI_FADT_S4_RTC_WAKE)
- dev_info(dev, "RTC can wake from S4\n");
-
-- dev->platform_data = &acpi_rtc_info;
--
- /* RTC always wakes from S1/S2/S3, and often S4/STD */
- device_init_wakeup(dev, 1);
- }
-@@ -1306,8 +1306,6 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- {
- int irq, ret;
-
-- cmos_wake_setup(&pnp->dev);
--
- if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) {
- irq = 0;
- #ifdef CONFIG_X86
-@@ -1415,7 +1413,6 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
- int irq, ret;
-
- cmos_of_init(pdev);
-- cmos_wake_setup(&pdev->dev);
-
- if (RTC_IOMAPPED)
- resource = platform_get_resource(pdev, IORESOURCE_IO, 0);
---
-2.35.1
-
+++ /dev/null
-From 7e8f14aa7fce24432349d67100dcc9fee176fb31 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 9 Nov 2022 13:09:07 +0100
-Subject: rtc: cmos: Call rtc_wake_setup() from cmos_do_probe()
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit 375bbba09692fe4c5218eddee8e312dd733fa846 ]
-
-To reduce code duplication, move the invocation of rtc_wake_setup()
-into cmos_do_probe() and simplify the callers of the latter.
-
-No intentional functional impact.
-
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Zhang Rui <rui.zhang@intel.com>
-Tested-by: Zhang Rui <rui.zhang@intel.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/2143522.irdbgypaU6@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 28 ++++++++++++----------------
- 1 file changed, 12 insertions(+), 16 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index c51f6450daf2..91205797bd0f 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -702,6 +702,7 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
- return IRQ_NONE;
- }
-
-+static inline void rtc_wake_setup(struct device *dev);
- static void cmos_wake_setup(struct device *dev);
-
- #ifdef CONFIG_PNP
-@@ -889,6 +890,13 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
- if (rtc_nvmem_register(cmos_rtc.rtc, &nvmem_cfg))
- dev_err(dev, "nvmem registration failed\n");
-
-+ /*
-+ * Everything has gone well so far, so by default register a handler for
-+ * the ACPI RTC fixed event.
-+ */
-+ if (!info)
-+ rtc_wake_setup(dev);
-+
- dev_info(dev, "%s%s, %d bytes nvram%s\n",
- !is_valid_irq(rtc_irq) ? "no alarms" :
- cmos_rtc.mon_alrm ? "alarms up to one year" :
-@@ -1304,7 +1312,7 @@ static void rtc_wake_setup(struct device *dev)
-
- static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- {
-- int irq, ret;
-+ int irq;
-
- if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) {
- irq = 0;
-@@ -1320,13 +1328,7 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- irq = pnp_irq(pnp, 0);
- }
-
-- ret = cmos_do_probe(&pnp->dev, pnp_get_resource(pnp, IORESOURCE_IO, 0), irq);
-- if (ret)
-- return ret;
--
-- rtc_wake_setup(&pnp->dev);
--
-- return 0;
-+ return cmos_do_probe(&pnp->dev, pnp_get_resource(pnp, IORESOURCE_IO, 0), irq);
- }
-
- static void cmos_pnp_remove(struct pnp_dev *pnp)
-@@ -1410,7 +1412,7 @@ static inline void cmos_of_init(struct platform_device *pdev) {}
- static int __init cmos_platform_probe(struct platform_device *pdev)
- {
- struct resource *resource;
-- int irq, ret;
-+ int irq;
-
- cmos_of_init(pdev);
-
-@@ -1422,13 +1424,7 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
- if (irq < 0)
- irq = -1;
-
-- ret = cmos_do_probe(&pdev->dev, resource, irq);
-- if (ret)
-- return ret;
--
-- rtc_wake_setup(&pdev->dev);
--
-- return 0;
-+ return cmos_do_probe(&pdev->dev, resource, irq);
- }
-
- static int cmos_platform_remove(struct platform_device *pdev)
---
-2.35.1
-
+++ /dev/null
-From bd12c3f117596bd694dff8d889680e03d8fc9ddc Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 9 Nov 2022 13:15:36 +0100
-Subject: rtc: cmos: Disable ACPI RTC event on removal
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit 83ebb7b3036d151ee39a4a752018665648fc3bd4 ]
-
-Make cmos_do_remove() drop the ACPI RTC fixed event handler so as to
-prevent it from operating on stale data in case the event triggers
-after driver removal.
-
-Fixes: 311ee9c151ad ("rtc: cmos: allow using ACPI for RTC alarm instead of HPET")
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Zhang Rui <rui.zhang@intel.com>
-Tested-by: Zhang Rui <rui.zhang@intel.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/2224609.iZASKD2KPV@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index 0c035c5a5ae6..5354c12f6b2a 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -756,6 +756,14 @@ static void acpi_rtc_event_setup(struct device *dev)
- acpi_disable_event(ACPI_EVENT_RTC, 0);
- }
-
-+static void acpi_rtc_event_cleanup(void)
-+{
-+ if (acpi_disabled)
-+ return;
-+
-+ acpi_remove_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler);
-+}
-+
- static void rtc_wake_on(struct device *dev)
- {
- acpi_clear_event(ACPI_EVENT_RTC);
-@@ -842,6 +850,10 @@ static inline void acpi_rtc_event_setup(struct device *dev)
- {
- }
-
-+static inline void acpi_rtc_event_cleanup(void)
-+{
-+}
-+
- static inline void acpi_cmos_wake_setup(struct device *dev)
- {
- }
-@@ -1089,6 +1101,9 @@ static void cmos_do_remove(struct device *dev)
- hpet_unregister_irq_handler(cmos_interrupt);
- }
-
-+ if (!dev_get_platdata(dev))
-+ acpi_rtc_event_cleanup();
-+
- cmos->rtc = NULL;
-
- ports = cmos->iomem;
---
-2.35.1
-
+++ /dev/null
-From 91d73e815bba4a40d9048c3c75f6fcf01ded4fd9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 9 Nov 2022 13:09:32 +0100
-Subject: rtc: cmos: Eliminate forward declarations of some functions
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit dca4d3b71c8a09a16951add656711fbd6f5bfbb0 ]
-
-Reorder the ACPI-related code before cmos_do_probe() so as to eliminate
-excessive forward declarations of some functions.
-
-While at it, for consistency, add the inline modifier to the
-definitions of empty stub static funtions and remove it from the
-corresponding definitions of functions with non-empty bodies.
-
-No intentional functional impact.
-
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Zhang Rui <rui.zhang@intel.com>
-Tested-by: Zhang Rui <rui.zhang@intel.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/13157911.uLZWGnKmhe@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 304 ++++++++++++++++++++---------------------
- 1 file changed, 149 insertions(+), 155 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index 91205797bd0f..909cb1d4a4d5 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -702,8 +702,155 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
- return IRQ_NONE;
- }
-
--static inline void rtc_wake_setup(struct device *dev);
--static void cmos_wake_setup(struct device *dev);
-+#ifdef CONFIG_ACPI
-+
-+#include <linux/acpi.h>
-+
-+static u32 rtc_handler(void *context)
-+{
-+ struct device *dev = context;
-+ struct cmos_rtc *cmos = dev_get_drvdata(dev);
-+ unsigned char rtc_control = 0;
-+ unsigned char rtc_intr;
-+ unsigned long flags;
-+
-+
-+ /*
-+ * Always update rtc irq when ACPI is used as RTC Alarm.
-+ * Or else, ACPI SCI is enabled during suspend/resume only,
-+ * update rtc irq in that case.
-+ */
-+ if (cmos_use_acpi_alarm())
-+ cmos_interrupt(0, (void *)cmos->rtc);
-+ else {
-+ /* Fix me: can we use cmos_interrupt() here as well? */
-+ spin_lock_irqsave(&rtc_lock, flags);
-+ if (cmos_rtc.suspend_ctrl)
-+ rtc_control = CMOS_READ(RTC_CONTROL);
-+ if (rtc_control & RTC_AIE) {
-+ cmos_rtc.suspend_ctrl &= ~RTC_AIE;
-+ CMOS_WRITE(rtc_control, RTC_CONTROL);
-+ rtc_intr = CMOS_READ(RTC_INTR_FLAGS);
-+ rtc_update_irq(cmos->rtc, 1, rtc_intr);
-+ }
-+ spin_unlock_irqrestore(&rtc_lock, flags);
-+ }
-+
-+ pm_wakeup_hard_event(dev);
-+ acpi_clear_event(ACPI_EVENT_RTC);
-+ acpi_disable_event(ACPI_EVENT_RTC, 0);
-+ return ACPI_INTERRUPT_HANDLED;
-+}
-+
-+static void rtc_wake_setup(struct device *dev)
-+{
-+ if (acpi_disabled)
-+ return;
-+
-+ acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, dev);
-+ /*
-+ * After the RTC handler is installed, the Fixed_RTC event should
-+ * be disabled. Only when the RTC alarm is set will it be enabled.
-+ */
-+ acpi_clear_event(ACPI_EVENT_RTC);
-+ acpi_disable_event(ACPI_EVENT_RTC, 0);
-+}
-+
-+static void rtc_wake_on(struct device *dev)
-+{
-+ acpi_clear_event(ACPI_EVENT_RTC);
-+ acpi_enable_event(ACPI_EVENT_RTC, 0);
-+}
-+
-+static void rtc_wake_off(struct device *dev)
-+{
-+ acpi_disable_event(ACPI_EVENT_RTC, 0);
-+}
-+
-+#ifdef CONFIG_X86
-+/* Enable use_acpi_alarm mode for Intel platforms no earlier than 2015 */
-+static void use_acpi_alarm_quirks(void)
-+{
-+ if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
-+ return;
-+
-+ if (!is_hpet_enabled())
-+ return;
-+
-+ if (dmi_get_bios_year() < 2015)
-+ return;
-+
-+ use_acpi_alarm = true;
-+}
-+#else
-+static inline void use_acpi_alarm_quirks(void) { }
-+#endif
-+
-+static void cmos_wake_setup(struct device *dev)
-+{
-+ if (acpi_disabled)
-+ return;
-+
-+ use_acpi_alarm_quirks();
-+
-+ cmos_rtc.wake_on = rtc_wake_on;
-+ cmos_rtc.wake_off = rtc_wake_off;
-+
-+ /* ACPI tables bug workaround. */
-+ if (acpi_gbl_FADT.month_alarm && !acpi_gbl_FADT.day_alarm) {
-+ dev_dbg(dev, "bogus FADT month_alarm (%d)\n",
-+ acpi_gbl_FADT.month_alarm);
-+ acpi_gbl_FADT.month_alarm = 0;
-+ }
-+
-+ cmos_rtc.day_alrm = acpi_gbl_FADT.day_alarm;
-+ cmos_rtc.mon_alrm = acpi_gbl_FADT.month_alarm;
-+ cmos_rtc.century = acpi_gbl_FADT.century;
-+
-+ if (acpi_gbl_FADT.flags & ACPI_FADT_S4_RTC_WAKE)
-+ dev_info(dev, "RTC can wake from S4\n");
-+
-+ /* RTC always wakes from S1/S2/S3, and often S4/STD */
-+ device_init_wakeup(dev, 1);
-+}
-+
-+static void cmos_check_acpi_rtc_status(struct device *dev,
-+ unsigned char *rtc_control)
-+{
-+ struct cmos_rtc *cmos = dev_get_drvdata(dev);
-+ acpi_event_status rtc_status;
-+ acpi_status status;
-+
-+ if (acpi_gbl_FADT.flags & ACPI_FADT_FIXED_RTC)
-+ return;
-+
-+ status = acpi_get_event_status(ACPI_EVENT_RTC, &rtc_status);
-+ if (ACPI_FAILURE(status)) {
-+ dev_err(dev, "Could not get RTC status\n");
-+ } else if (rtc_status & ACPI_EVENT_FLAG_SET) {
-+ unsigned char mask;
-+ *rtc_control &= ~RTC_AIE;
-+ CMOS_WRITE(*rtc_control, RTC_CONTROL);
-+ mask = CMOS_READ(RTC_INTR_FLAGS);
-+ rtc_update_irq(cmos->rtc, 1, mask);
-+ }
-+}
-+
-+#else /* !CONFIG_ACPI */
-+
-+static inline void rtc_wake_setup(struct device *dev)
-+{
-+}
-+
-+static inline void cmos_wake_setup(struct device *dev)
-+{
-+}
-+
-+static inline void cmos_check_acpi_rtc_status(struct device *dev,
-+ unsigned char *rtc_control)
-+{
-+}
-+#endif /* CONFIG_ACPI */
-
- #ifdef CONFIG_PNP
- #define INITSECTION
-@@ -1087,9 +1234,6 @@ static void cmos_check_wkalrm(struct device *dev)
- }
- }
-
--static void cmos_check_acpi_rtc_status(struct device *dev,
-- unsigned char *rtc_control);
--
- static int __maybe_unused cmos_resume(struct device *dev)
- {
- struct cmos_rtc *cmos = dev_get_drvdata(dev);
-@@ -1156,156 +1300,6 @@ static SIMPLE_DEV_PM_OPS(cmos_pm_ops, cmos_suspend, cmos_resume);
- * predate even PNPBIOS should set up platform_bus devices.
- */
-
--#ifdef CONFIG_ACPI
--
--#include <linux/acpi.h>
--
--static u32 rtc_handler(void *context)
--{
-- struct device *dev = context;
-- struct cmos_rtc *cmos = dev_get_drvdata(dev);
-- unsigned char rtc_control = 0;
-- unsigned char rtc_intr;
-- unsigned long flags;
--
--
-- /*
-- * Always update rtc irq when ACPI is used as RTC Alarm.
-- * Or else, ACPI SCI is enabled during suspend/resume only,
-- * update rtc irq in that case.
-- */
-- if (cmos_use_acpi_alarm())
-- cmos_interrupt(0, (void *)cmos->rtc);
-- else {
-- /* Fix me: can we use cmos_interrupt() here as well? */
-- spin_lock_irqsave(&rtc_lock, flags);
-- if (cmos_rtc.suspend_ctrl)
-- rtc_control = CMOS_READ(RTC_CONTROL);
-- if (rtc_control & RTC_AIE) {
-- cmos_rtc.suspend_ctrl &= ~RTC_AIE;
-- CMOS_WRITE(rtc_control, RTC_CONTROL);
-- rtc_intr = CMOS_READ(RTC_INTR_FLAGS);
-- rtc_update_irq(cmos->rtc, 1, rtc_intr);
-- }
-- spin_unlock_irqrestore(&rtc_lock, flags);
-- }
--
-- pm_wakeup_hard_event(dev);
-- acpi_clear_event(ACPI_EVENT_RTC);
-- acpi_disable_event(ACPI_EVENT_RTC, 0);
-- return ACPI_INTERRUPT_HANDLED;
--}
--
--static inline void rtc_wake_setup(struct device *dev)
--{
-- if (acpi_disabled)
-- return;
--
-- acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, dev);
-- /*
-- * After the RTC handler is installed, the Fixed_RTC event should
-- * be disabled. Only when the RTC alarm is set will it be enabled.
-- */
-- acpi_clear_event(ACPI_EVENT_RTC);
-- acpi_disable_event(ACPI_EVENT_RTC, 0);
--}
--
--static void rtc_wake_on(struct device *dev)
--{
-- acpi_clear_event(ACPI_EVENT_RTC);
-- acpi_enable_event(ACPI_EVENT_RTC, 0);
--}
--
--static void rtc_wake_off(struct device *dev)
--{
-- acpi_disable_event(ACPI_EVENT_RTC, 0);
--}
--
--#ifdef CONFIG_X86
--/* Enable use_acpi_alarm mode for Intel platforms no earlier than 2015 */
--static void use_acpi_alarm_quirks(void)
--{
-- if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
-- return;
--
-- if (!is_hpet_enabled())
-- return;
--
-- if (dmi_get_bios_year() < 2015)
-- return;
--
-- use_acpi_alarm = true;
--}
--#else
--static inline void use_acpi_alarm_quirks(void) { }
--#endif
--
--static void cmos_wake_setup(struct device *dev)
--{
-- if (acpi_disabled)
-- return;
--
-- use_acpi_alarm_quirks();
--
-- cmos_rtc.wake_on = rtc_wake_on;
-- cmos_rtc.wake_off = rtc_wake_off;
--
-- /* ACPI tables bug workaround. */
-- if (acpi_gbl_FADT.month_alarm && !acpi_gbl_FADT.day_alarm) {
-- dev_dbg(dev, "bogus FADT month_alarm (%d)\n",
-- acpi_gbl_FADT.month_alarm);
-- acpi_gbl_FADT.month_alarm = 0;
-- }
--
-- cmos_rtc.day_alrm = acpi_gbl_FADT.day_alarm;
-- cmos_rtc.mon_alrm = acpi_gbl_FADT.month_alarm;
-- cmos_rtc.century = acpi_gbl_FADT.century;
--
-- if (acpi_gbl_FADT.flags & ACPI_FADT_S4_RTC_WAKE)
-- dev_info(dev, "RTC can wake from S4\n");
--
-- /* RTC always wakes from S1/S2/S3, and often S4/STD */
-- device_init_wakeup(dev, 1);
--}
--
--static void cmos_check_acpi_rtc_status(struct device *dev,
-- unsigned char *rtc_control)
--{
-- struct cmos_rtc *cmos = dev_get_drvdata(dev);
-- acpi_event_status rtc_status;
-- acpi_status status;
--
-- if (acpi_gbl_FADT.flags & ACPI_FADT_FIXED_RTC)
-- return;
--
-- status = acpi_get_event_status(ACPI_EVENT_RTC, &rtc_status);
-- if (ACPI_FAILURE(status)) {
-- dev_err(dev, "Could not get RTC status\n");
-- } else if (rtc_status & ACPI_EVENT_FLAG_SET) {
-- unsigned char mask;
-- *rtc_control &= ~RTC_AIE;
-- CMOS_WRITE(*rtc_control, RTC_CONTROL);
-- mask = CMOS_READ(RTC_INTR_FLAGS);
-- rtc_update_irq(cmos->rtc, 1, mask);
-- }
--}
--
--#else
--
--static void cmos_wake_setup(struct device *dev)
--{
--}
--
--static void cmos_check_acpi_rtc_status(struct device *dev,
-- unsigned char *rtc_control)
--{
--}
--
--static void rtc_wake_setup(struct device *dev)
--{
--}
--#endif
--
- #ifdef CONFIG_PNP
-
- #include <linux/pnp.h>
---
-2.35.1
-
+++ /dev/null
-From 85df9d346c5c333acc8c779f466016369a7f9a32 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 18 Oct 2022 22:35:11 +0200
-Subject: rtc: cmos: fix build on non-ACPI platforms
-
-From: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
-[ Upstream commit db4e955ae333567dea02822624106c0b96a2f84f ]
-
-Now that rtc_wake_setup is called outside of cmos_wake_setup, it also need
-to be defined on non-ACPI platforms.
-
-Reported-by: kernel test robot <lkp@intel.com>
-Link: https://lore.kernel.org/r/20221018203512.2532407-1-alexandre.belloni@bootlin.com
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index d8384f7a7381..e83b976b9abe 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -1293,6 +1293,9 @@ static void cmos_check_acpi_rtc_status(struct device *dev,
- {
- }
-
-+static void rtc_wake_setup(struct device *dev)
-+{
-+}
- #endif
-
- #ifdef CONFIG_PNP
---
-2.35.1
-
+++ /dev/null
-From 20c7d95c69551b43f7de3894d5bdb33ddcd37e91 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 12 Oct 2022 20:07:01 +0200
-Subject: rtc: cmos: Fix event handler registration ordering issue
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit 4919d3eb2ec0ee364f7e3cf2d99646c1b224fae8 ]
-
-Because acpi_install_fixed_event_handler() enables the event
-automatically on success, it is incorrect to call it before the
-handler routine passed to it is ready to handle events.
-
-Unfortunately, the rtc-cmos driver does exactly the incorrect thing
-by calling cmos_wake_setup(), which passes rtc_handler() to
-acpi_install_fixed_event_handler(), before cmos_do_probe(), because
-rtc_handler() uses dev_get_drvdata() to get to the cmos object
-pointer and the driver data pointer is only populated in
-cmos_do_probe().
-
-This leads to a NULL pointer dereference in rtc_handler() on boot
-if the RTC fixed event happens to be active at the init time.
-
-To address this issue, change the initialization ordering of the
-driver so that cmos_wake_setup() is always called after a successful
-cmos_do_probe() call.
-
-While at it, change cmos_pnp_probe() to call cmos_do_probe() after
-the initial if () statement used for computing the IRQ argument to
-be passed to cmos_do_probe() which is cleaner than calling it in
-each branch of that if () (local variable "irq" can be of type int,
-because it is passed to that function as an argument of type int).
-
-Note that commit 6492fed7d8c9 ("rtc: rtc-cmos: Do not check
-ACPI_FADT_LOW_POWER_S0") caused this issue to affect a larger number
-of systems, because previously it only affected systems with
-ACPI_FADT_LOW_POWER_S0 set, but it is present regardless of that
-commit.
-
-Fixes: 6492fed7d8c9 ("rtc: rtc-cmos: Do not check ACPI_FADT_LOW_POWER_S0")
-Fixes: a474aaedac99 ("rtc-cmos: move wake setup from ACPI glue into RTC driver")
-Link: https://lore.kernel.org/linux-acpi/20221010141630.zfzi7mk7zvnmclzy@techsingularity.net/
-Reported-by: Mel Gorman <mgorman@techsingularity.net>
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
-Tested-by: Mel Gorman <mgorman@techsingularity.net>
-Link: https://lore.kernel.org/r/5629262.DvuYhMxLoT@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 29 +++++++++++++++++++----------
- 1 file changed, 19 insertions(+), 10 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index c7f6088ef91f..7962cdd933f9 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -1299,10 +1299,10 @@ static void cmos_check_acpi_rtc_status(struct device *dev,
-
- static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- {
-- cmos_wake_setup(&pnp->dev);
-+ int irq, ret;
-
- if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) {
-- unsigned int irq = 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
-@@ -1311,13 +1311,17 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- if (nr_legacy_irqs())
- irq = 8;
- #endif
-- return cmos_do_probe(&pnp->dev,
-- pnp_get_resource(pnp, IORESOURCE_IO, 0), irq);
- } else {
-- return cmos_do_probe(&pnp->dev,
-- pnp_get_resource(pnp, IORESOURCE_IO, 0),
-- pnp_irq(pnp, 0));
-+ irq = pnp_irq(pnp, 0);
- }
-+
-+ ret = cmos_do_probe(&pnp->dev, pnp_get_resource(pnp, IORESOURCE_IO, 0), irq);
-+ if (ret)
-+ return ret;
-+
-+ cmos_wake_setup(&pnp->dev);
-+
-+ return 0;
- }
-
- static void cmos_pnp_remove(struct pnp_dev *pnp)
-@@ -1401,10 +1405,9 @@ static inline void cmos_of_init(struct platform_device *pdev) {}
- static int __init cmos_platform_probe(struct platform_device *pdev)
- {
- struct resource *resource;
-- int irq;
-+ int irq, ret;
-
- cmos_of_init(pdev);
-- cmos_wake_setup(&pdev->dev);
-
- if (RTC_IOMAPPED)
- resource = platform_get_resource(pdev, IORESOURCE_IO, 0);
-@@ -1414,7 +1417,13 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
- if (irq < 0)
- irq = -1;
-
-- return cmos_do_probe(&pdev->dev, resource, irq);
-+ ret = cmos_do_probe(&pdev->dev, resource, irq);
-+ if (ret)
-+ return ret;
-+
-+ cmos_wake_setup(&pdev->dev);
-+
-+ return 0;
- }
-
- static int cmos_platform_remove(struct platform_device *pdev)
---
-2.35.1
-
+++ /dev/null
-From e1774c490ea79fe1d2fdeae8bef8d8828d7c7935 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 18 Oct 2022 18:09:31 +0200
-Subject: rtc: cmos: Fix wake alarm breakage
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit 0782b66ed2fbb035dda76111df0954515e417b24 ]
-
-Commit 4919d3eb2ec0 ("rtc: cmos: Fix event handler registration
-ordering issue") overlooked the fact that cmos_do_probe() depended
-on the preparations carried out by cmos_wake_setup() and the wake
-alarm stopped working after the ordering of them had been changed.
-
-Address this by partially reverting commit 4919d3eb2ec0 so that
-cmos_wake_setup() is called before cmos_do_probe() again and moving
-the rtc_wake_setup() invocation from cmos_wake_setup() directly to the
-callers of cmos_do_probe() where it will happen after a successful
-completion of the latter.
-
-Fixes: 4919d3eb2ec0 ("rtc: cmos: Fix event handler registration ordering issue")
-Reported-by: Zhang Rui <rui.zhang@intel.com>
-Reported-by: Todd Brandt <todd.e.brandt@linux.intel.com>
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Link: https://lore.kernel.org/r/5887691.lOV4Wx5bFT@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index 7962cdd933f9..d8384f7a7381 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -1180,6 +1180,9 @@ static u32 rtc_handler(void *context)
-
- static inline void rtc_wake_setup(struct device *dev)
- {
-+ if (acpi_disabled)
-+ return;
-+
- acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, dev);
- /*
- * After the RTC handler is installed, the Fixed_RTC event should
-@@ -1233,7 +1236,6 @@ static void cmos_wake_setup(struct device *dev)
-
- use_acpi_alarm_quirks();
-
-- rtc_wake_setup(dev);
- acpi_rtc_info.wake_on = rtc_wake_on;
- acpi_rtc_info.wake_off = rtc_wake_off;
-
-@@ -1301,6 +1303,8 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- {
- int irq, ret;
-
-+ cmos_wake_setup(&pnp->dev);
-+
- if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) {
- irq = 0;
- #ifdef CONFIG_X86
-@@ -1319,7 +1323,7 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- if (ret)
- return ret;
-
-- cmos_wake_setup(&pnp->dev);
-+ rtc_wake_setup(&pnp->dev);
-
- return 0;
- }
-@@ -1408,6 +1412,7 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
- int irq, ret;
-
- cmos_of_init(pdev);
-+ cmos_wake_setup(&pdev->dev);
-
- if (RTC_IOMAPPED)
- resource = platform_get_resource(pdev, IORESOURCE_IO, 0);
-@@ -1421,7 +1426,7 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
- if (ret)
- return ret;
-
-- cmos_wake_setup(&pdev->dev);
-+ rtc_wake_setup(&pdev->dev);
-
- return 0;
- }
---
-2.35.1
-
+++ /dev/null
-From c4809f41861d8540acdb8e36603c124fccf65773 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 23 Jan 2020 15:14:37 +0200
-Subject: rtc: cmos: Refactor code by using the new dmi_get_bios_year() helper
-
-From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
-[ Upstream commit 604c521259c8051b7607c000eda7938f7a705d92 ]
-
-Refactor code by using the new dmi_get_bios_year() helper instead of
-open coding its functionality. This also makes logic slightly clearer.
-
-No changes intended.
-
-Cc: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Tested-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
-Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-Link: https://lore.kernel.org/r/20200123131437.28157-3-andriy.shevchenko@linux.intel.com
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index 8545f0da57fe..58a3104b8a1c 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -1204,8 +1204,6 @@ static void rtc_wake_off(struct device *dev)
- /* Enable use_acpi_alarm mode for Intel platforms no earlier than 2015 */
- static void use_acpi_alarm_quirks(void)
- {
-- int year;
--
- if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
- return;
-
-@@ -1215,8 +1213,10 @@ static void use_acpi_alarm_quirks(void)
- if (!is_hpet_enabled())
- return;
-
-- if (dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL) && year >= 2015)
-- use_acpi_alarm = true;
-+ if (dmi_get_bios_year() < 2015)
-+ return;
-+
-+ use_acpi_alarm = true;
- }
- #else
- static inline void use_acpi_alarm_quirks(void) { }
---
-2.35.1
-
+++ /dev/null
-From 2849c6a9334fa7f7f8d79aac762f1ffbd8487611 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 9 Nov 2022 13:12:00 +0100
-Subject: rtc: cmos: Rename ACPI-related functions
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit d13e9ad9f5146f066a5c5a1cc993d09e4fb21ead ]
-
-The names of rtc_wake_setup() and cmos_wake_setup() don't indicate
-that these functions are ACPI-related, which is the case, and the
-former doesn't really reflect the role of the function.
-
-Rename them to acpi_rtc_event_setup() and acpi_cmos_wake_setup(),
-respectively, to address this shortcoming.
-
-No intentional functional impact.
-
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Zhang Rui <rui.zhang@intel.com>
-Tested-by: Zhang Rui <rui.zhang@intel.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/3225614.44csPzL39Z@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index 909cb1d4a4d5..0c035c5a5ae6 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -742,7 +742,7 @@ static u32 rtc_handler(void *context)
- return ACPI_INTERRUPT_HANDLED;
- }
-
--static void rtc_wake_setup(struct device *dev)
-+static void acpi_rtc_event_setup(struct device *dev)
- {
- if (acpi_disabled)
- return;
-@@ -786,7 +786,7 @@ static void use_acpi_alarm_quirks(void)
- static inline void use_acpi_alarm_quirks(void) { }
- #endif
-
--static void cmos_wake_setup(struct device *dev)
-+static void acpi_cmos_wake_setup(struct device *dev)
- {
- if (acpi_disabled)
- return;
-@@ -838,11 +838,11 @@ static void cmos_check_acpi_rtc_status(struct device *dev,
-
- #else /* !CONFIG_ACPI */
-
--static inline void rtc_wake_setup(struct device *dev)
-+static inline void acpi_rtc_event_setup(struct device *dev)
- {
- }
-
--static inline void cmos_wake_setup(struct device *dev)
-+static inline void acpi_cmos_wake_setup(struct device *dev)
- {
- }
-
-@@ -944,7 +944,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
- cmos_rtc.wake_off = info->wake_off;
- }
- } else {
-- cmos_wake_setup(dev);
-+ acpi_cmos_wake_setup(dev);
- }
-
- if (cmos_rtc.day_alrm >= 128)
-@@ -1042,7 +1042,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
- * the ACPI RTC fixed event.
- */
- if (!info)
-- rtc_wake_setup(dev);
-+ acpi_rtc_event_setup(dev);
-
- dev_info(dev, "%s%s, %d bytes nvram%s\n",
- !is_valid_irq(rtc_irq) ? "no alarms" :
---
-2.35.1
-
+++ /dev/null
-From b2d06a97b1870a3e0e049d6081bdf4e154194794 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 8 Aug 2022 20:23:59 +0200
-Subject: rtc: rtc-cmos: Do not check ACPI_FADT_LOW_POWER_S0
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit 6492fed7d8c95f53b0b804ef541324d924d95d41 ]
-
-The ACPI_FADT_LOW_POWER_S0 flag merely means that it is better to
-use low-power S0 idle on the given platform than S3 (provided that
-the latter is supported) and it doesn't preclude using either of
-them (which of them will be used depends on the choices made by user
-space).
-
-For this reason, there is no benefit from checking that flag in
-use_acpi_alarm_quirks().
-
-First off, it cannot be a bug to do S3 with use_acpi_alarm set,
-because S3 can be used on systems with ACPI_FADT_LOW_POWER_S0 and it
-must work if really supported, so the ACPI_FADT_LOW_POWER_S0 check is
-not needed to protect the S3-capable systems from failing.
-
-Second, suspend-to-idle can be carried out on a system with
-ACPI_FADT_LOW_POWER_S0 unset and it is expected to work, so if setting
-use_acpi_alarm is needed to handle that case correctly, it should be
-set regardless of the ACPI_FADT_LOW_POWER_S0 value.
-
-Accordingly, drop the ACPI_FADT_LOW_POWER_S0 check from
-use_acpi_alarm_quirks().
-
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Link: https://lore.kernel.org/r/12054246.O9o76ZdvQC@kreacher
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index 58a3104b8a1c..c7f6088ef91f 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -1207,9 +1207,6 @@ static void use_acpi_alarm_quirks(void)
- if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
- return;
-
-- if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
-- return;
--
- if (!is_hpet_enabled())
- return;
-
---
-2.35.1
-
perf-symbol-correction-while-adjusting-symbol.patch
hsi-omap_ssi_core-fix-error-handling-in-ssi_init.patch
include-uapi-linux-swab-fix-potentially-missing-__al.patch
-rtc-cmos-refactor-code-by-using-the-new-dmi_get_bios.patch
-rtc-rtc-cmos-do-not-check-acpi_fadt_low_power_s0.patch
-rtc-cmos-fix-event-handler-registration-ordering-iss.patch
-rtc-cmos-fix-wake-alarm-breakage.patch
-rtc-cmos-fix-build-on-non-acpi-platforms.patch
-rtc-cmos-call-cmos_wake_setup-from-cmos_do_probe.patch
-rtc-cmos-call-rtc_wake_setup-from-cmos_do_probe.patch
-rtc-cmos-eliminate-forward-declarations-of-some-func.patch
-rtc-cmos-rename-acpi-related-functions.patch
-rtc-cmos-disable-acpi-rtc-event-on-removal.patch
rtc-snvs-allow-a-time-difference-on-clock-register-r.patch
iommu-amd-fix-pci-device-refcount-leak-in-ppr_notifi.patch
iommu-fsl_pamu-fix-resource-leak-in-fsl_pamu_probe.patch
+++ /dev/null
-From 6eea237199270a5da9375be969c1296dd7efd68b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 9 Nov 2022 13:07:08 +0100
-Subject: rtc: cmos: Call cmos_wake_setup() from cmos_do_probe()
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit 508ccdfb86b21da37ad091003a4d4567709d5dfb ]
-
-Notice that cmos_wake_setup() is the only user of acpi_rtc_info and it
-can operate on the cmos_rtc variable directly, so it need not set the
-platform_data pointer before cmos_do_probe() is called. Instead, it
-can be called by cmos_do_probe() in the case when the platform_data
-pointer is not set to implement the default behavior (which is to use
-the FADT information as long as ACPI support is enabled).
-
-Modify the code accordingly.
-
-While at it, drop a comment that doesn't really match the code it is
-supposed to be describing.
-
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Zhang Rui <rui.zhang@intel.com>
-Tested-by: Zhang Rui <rui.zhang@intel.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/4803444.31r3eYUQgx@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 47 ++++++++++++++++++++----------------------
- 1 file changed, 22 insertions(+), 25 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index 3e9168cfbe5c..fa0098390315 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -698,6 +698,8 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
- return IRQ_NONE;
- }
-
-+static void cmos_wake_setup(struct device *dev);
-+
- #ifdef CONFIG_PNP
- #define INITSECTION
-
-@@ -781,19 +783,27 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
- if (info->address_space)
- address_space = info->address_space;
-
-- if (info->rtc_day_alarm && info->rtc_day_alarm < 128)
-- cmos_rtc.day_alrm = info->rtc_day_alarm;
-- if (info->rtc_mon_alarm && info->rtc_mon_alarm < 128)
-- cmos_rtc.mon_alrm = info->rtc_mon_alarm;
-- if (info->rtc_century && info->rtc_century < 128)
-- cmos_rtc.century = info->rtc_century;
-+ cmos_rtc.day_alrm = info->rtc_day_alarm;
-+ cmos_rtc.mon_alrm = info->rtc_mon_alarm;
-+ cmos_rtc.century = info->rtc_century;
-
- if (info->wake_on && info->wake_off) {
- cmos_rtc.wake_on = info->wake_on;
- cmos_rtc.wake_off = info->wake_off;
- }
-+ } else {
-+ cmos_wake_setup(dev);
- }
-
-+ if (cmos_rtc.day_alrm >= 128)
-+ cmos_rtc.day_alrm = 0;
-+
-+ if (cmos_rtc.mon_alrm >= 128)
-+ cmos_rtc.mon_alrm = 0;
-+
-+ if (cmos_rtc.century >= 128)
-+ cmos_rtc.century = 0;
-+
- cmos_rtc.dev = dev;
- dev_set_drvdata(dev, &cmos_rtc);
-
-@@ -1218,13 +1228,6 @@ static void use_acpi_alarm_quirks(void)
- static inline void use_acpi_alarm_quirks(void) { }
- #endif
-
--/* Every ACPI platform has a mc146818 compatible "cmos rtc". Here we find
-- * its device node and pass extra config data. This helps its driver use
-- * capabilities that the now-obsolete mc146818 didn't have, and informs it
-- * that this board's RTC is wakeup-capable (per ACPI spec).
-- */
--static struct cmos_rtc_board_info acpi_rtc_info;
--
- static void cmos_wake_setup(struct device *dev)
- {
- if (acpi_disabled)
-@@ -1232,26 +1235,23 @@ static void cmos_wake_setup(struct device *dev)
-
- use_acpi_alarm_quirks();
-
-- acpi_rtc_info.wake_on = rtc_wake_on;
-- acpi_rtc_info.wake_off = rtc_wake_off;
-+ cmos_rtc.wake_on = rtc_wake_on;
-+ cmos_rtc.wake_off = rtc_wake_off;
-
-- /* workaround bug in some ACPI tables */
-+ /* ACPI tables bug workaround. */
- if (acpi_gbl_FADT.month_alarm && !acpi_gbl_FADT.day_alarm) {
- dev_dbg(dev, "bogus FADT month_alarm (%d)\n",
- acpi_gbl_FADT.month_alarm);
- acpi_gbl_FADT.month_alarm = 0;
- }
-
-- acpi_rtc_info.rtc_day_alarm = acpi_gbl_FADT.day_alarm;
-- acpi_rtc_info.rtc_mon_alarm = acpi_gbl_FADT.month_alarm;
-- acpi_rtc_info.rtc_century = acpi_gbl_FADT.century;
-+ cmos_rtc.day_alrm = acpi_gbl_FADT.day_alarm;
-+ cmos_rtc.mon_alrm = acpi_gbl_FADT.month_alarm;
-+ cmos_rtc.century = acpi_gbl_FADT.century;
-
-- /* NOTE: S4_RTC_WAKE is NOT currently useful to Linux */
- if (acpi_gbl_FADT.flags & ACPI_FADT_S4_RTC_WAKE)
- dev_info(dev, "RTC can wake from S4\n");
-
-- dev->platform_data = &acpi_rtc_info;
--
- /* RTC always wakes from S1/S2/S3, and often S4/STD */
- device_init_wakeup(dev, 1);
- }
-@@ -1302,8 +1302,6 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- {
- int irq, ret;
-
-- cmos_wake_setup(&pnp->dev);
--
- if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) {
- irq = 0;
- #ifdef CONFIG_X86
-@@ -1411,7 +1409,6 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
- int irq, ret;
-
- cmos_of_init(pdev);
-- cmos_wake_setup(&pdev->dev);
-
- if (RTC_IOMAPPED)
- resource = platform_get_resource(pdev, IORESOURCE_IO, 0);
---
-2.35.1
-
+++ /dev/null
-From 139b75c7bb068023f0cef78e233d4c42858dcca5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 9 Nov 2022 13:09:07 +0100
-Subject: rtc: cmos: Call rtc_wake_setup() from cmos_do_probe()
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit 375bbba09692fe4c5218eddee8e312dd733fa846 ]
-
-To reduce code duplication, move the invocation of rtc_wake_setup()
-into cmos_do_probe() and simplify the callers of the latter.
-
-No intentional functional impact.
-
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Zhang Rui <rui.zhang@intel.com>
-Tested-by: Zhang Rui <rui.zhang@intel.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/2143522.irdbgypaU6@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 28 ++++++++++++----------------
- 1 file changed, 12 insertions(+), 16 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index fa0098390315..27150d86f5ed 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -698,6 +698,7 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
- return IRQ_NONE;
- }
-
-+static inline void rtc_wake_setup(struct device *dev);
- static void cmos_wake_setup(struct device *dev);
-
- #ifdef CONFIG_PNP
-@@ -885,6 +886,13 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
- if (rtc_nvmem_register(cmos_rtc.rtc, &nvmem_cfg))
- dev_err(dev, "nvmem registration failed\n");
-
-+ /*
-+ * Everything has gone well so far, so by default register a handler for
-+ * the ACPI RTC fixed event.
-+ */
-+ if (!info)
-+ rtc_wake_setup(dev);
-+
- dev_info(dev, "%s%s, %d bytes nvram%s\n",
- !is_valid_irq(rtc_irq) ? "no alarms" :
- cmos_rtc.mon_alrm ? "alarms up to one year" :
-@@ -1300,7 +1308,7 @@ static void rtc_wake_setup(struct device *dev)
-
- static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- {
-- int irq, ret;
-+ int irq;
-
- if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) {
- irq = 0;
-@@ -1316,13 +1324,7 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- irq = pnp_irq(pnp, 0);
- }
-
-- ret = cmos_do_probe(&pnp->dev, pnp_get_resource(pnp, IORESOURCE_IO, 0), irq);
-- if (ret)
-- return ret;
--
-- rtc_wake_setup(&pnp->dev);
--
-- return 0;
-+ return cmos_do_probe(&pnp->dev, pnp_get_resource(pnp, IORESOURCE_IO, 0), irq);
- }
-
- static void cmos_pnp_remove(struct pnp_dev *pnp)
-@@ -1406,7 +1408,7 @@ static inline void cmos_of_init(struct platform_device *pdev) {}
- static int __init cmos_platform_probe(struct platform_device *pdev)
- {
- struct resource *resource;
-- int irq, ret;
-+ int irq;
-
- cmos_of_init(pdev);
-
-@@ -1418,13 +1420,7 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
- if (irq < 0)
- irq = -1;
-
-- ret = cmos_do_probe(&pdev->dev, resource, irq);
-- if (ret)
-- return ret;
--
-- rtc_wake_setup(&pdev->dev);
--
-- return 0;
-+ return cmos_do_probe(&pdev->dev, resource, irq);
- }
-
- static int cmos_platform_remove(struct platform_device *pdev)
---
-2.35.1
-
+++ /dev/null
-From 206c1090d35d5c5f0e864b6d690149560273c0ab Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 9 Nov 2022 13:15:36 +0100
-Subject: rtc: cmos: Disable ACPI RTC event on removal
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit 83ebb7b3036d151ee39a4a752018665648fc3bd4 ]
-
-Make cmos_do_remove() drop the ACPI RTC fixed event handler so as to
-prevent it from operating on stale data in case the event triggers
-after driver removal.
-
-Fixes: 311ee9c151ad ("rtc: cmos: allow using ACPI for RTC alarm instead of HPET")
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Zhang Rui <rui.zhang@intel.com>
-Tested-by: Zhang Rui <rui.zhang@intel.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/2224609.iZASKD2KPV@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index 203f41afe8c1..636d6ef45481 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -752,6 +752,14 @@ static void acpi_rtc_event_setup(struct device *dev)
- acpi_disable_event(ACPI_EVENT_RTC, 0);
- }
-
-+static void acpi_rtc_event_cleanup(void)
-+{
-+ if (acpi_disabled)
-+ return;
-+
-+ acpi_remove_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler);
-+}
-+
- static void rtc_wake_on(struct device *dev)
- {
- acpi_clear_event(ACPI_EVENT_RTC);
-@@ -838,6 +846,10 @@ static inline void acpi_rtc_event_setup(struct device *dev)
- {
- }
-
-+static inline void acpi_rtc_event_cleanup(void)
-+{
-+}
-+
- static inline void acpi_cmos_wake_setup(struct device *dev)
- {
- }
-@@ -1085,6 +1097,9 @@ static void cmos_do_remove(struct device *dev)
- hpet_unregister_irq_handler(cmos_interrupt);
- }
-
-+ if (!dev_get_platdata(dev))
-+ acpi_rtc_event_cleanup();
-+
- cmos->rtc = NULL;
-
- ports = cmos->iomem;
---
-2.35.1
-
+++ /dev/null
-From 5791c7bcd6b741cb574e145f02b48952d3e5310d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 9 Nov 2022 13:09:32 +0100
-Subject: rtc: cmos: Eliminate forward declarations of some functions
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit dca4d3b71c8a09a16951add656711fbd6f5bfbb0 ]
-
-Reorder the ACPI-related code before cmos_do_probe() so as to eliminate
-excessive forward declarations of some functions.
-
-While at it, for consistency, add the inline modifier to the
-definitions of empty stub static funtions and remove it from the
-corresponding definitions of functions with non-empty bodies.
-
-No intentional functional impact.
-
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Zhang Rui <rui.zhang@intel.com>
-Tested-by: Zhang Rui <rui.zhang@intel.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/13157911.uLZWGnKmhe@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 304 ++++++++++++++++++++---------------------
- 1 file changed, 149 insertions(+), 155 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index 27150d86f5ed..bc8f65014025 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -698,8 +698,155 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
- return IRQ_NONE;
- }
-
--static inline void rtc_wake_setup(struct device *dev);
--static void cmos_wake_setup(struct device *dev);
-+#ifdef CONFIG_ACPI
-+
-+#include <linux/acpi.h>
-+
-+static u32 rtc_handler(void *context)
-+{
-+ struct device *dev = context;
-+ struct cmos_rtc *cmos = dev_get_drvdata(dev);
-+ unsigned char rtc_control = 0;
-+ unsigned char rtc_intr;
-+ unsigned long flags;
-+
-+
-+ /*
-+ * Always update rtc irq when ACPI is used as RTC Alarm.
-+ * Or else, ACPI SCI is enabled during suspend/resume only,
-+ * update rtc irq in that case.
-+ */
-+ if (cmos_use_acpi_alarm())
-+ cmos_interrupt(0, (void *)cmos->rtc);
-+ else {
-+ /* Fix me: can we use cmos_interrupt() here as well? */
-+ spin_lock_irqsave(&rtc_lock, flags);
-+ if (cmos_rtc.suspend_ctrl)
-+ rtc_control = CMOS_READ(RTC_CONTROL);
-+ if (rtc_control & RTC_AIE) {
-+ cmos_rtc.suspend_ctrl &= ~RTC_AIE;
-+ CMOS_WRITE(rtc_control, RTC_CONTROL);
-+ rtc_intr = CMOS_READ(RTC_INTR_FLAGS);
-+ rtc_update_irq(cmos->rtc, 1, rtc_intr);
-+ }
-+ spin_unlock_irqrestore(&rtc_lock, flags);
-+ }
-+
-+ pm_wakeup_hard_event(dev);
-+ acpi_clear_event(ACPI_EVENT_RTC);
-+ acpi_disable_event(ACPI_EVENT_RTC, 0);
-+ return ACPI_INTERRUPT_HANDLED;
-+}
-+
-+static void rtc_wake_setup(struct device *dev)
-+{
-+ if (acpi_disabled)
-+ return;
-+
-+ acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, dev);
-+ /*
-+ * After the RTC handler is installed, the Fixed_RTC event should
-+ * be disabled. Only when the RTC alarm is set will it be enabled.
-+ */
-+ acpi_clear_event(ACPI_EVENT_RTC);
-+ acpi_disable_event(ACPI_EVENT_RTC, 0);
-+}
-+
-+static void rtc_wake_on(struct device *dev)
-+{
-+ acpi_clear_event(ACPI_EVENT_RTC);
-+ acpi_enable_event(ACPI_EVENT_RTC, 0);
-+}
-+
-+static void rtc_wake_off(struct device *dev)
-+{
-+ acpi_disable_event(ACPI_EVENT_RTC, 0);
-+}
-+
-+#ifdef CONFIG_X86
-+/* Enable use_acpi_alarm mode for Intel platforms no earlier than 2015 */
-+static void use_acpi_alarm_quirks(void)
-+{
-+ if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
-+ return;
-+
-+ if (!is_hpet_enabled())
-+ return;
-+
-+ if (dmi_get_bios_year() < 2015)
-+ return;
-+
-+ use_acpi_alarm = true;
-+}
-+#else
-+static inline void use_acpi_alarm_quirks(void) { }
-+#endif
-+
-+static void cmos_wake_setup(struct device *dev)
-+{
-+ if (acpi_disabled)
-+ return;
-+
-+ use_acpi_alarm_quirks();
-+
-+ cmos_rtc.wake_on = rtc_wake_on;
-+ cmos_rtc.wake_off = rtc_wake_off;
-+
-+ /* ACPI tables bug workaround. */
-+ if (acpi_gbl_FADT.month_alarm && !acpi_gbl_FADT.day_alarm) {
-+ dev_dbg(dev, "bogus FADT month_alarm (%d)\n",
-+ acpi_gbl_FADT.month_alarm);
-+ acpi_gbl_FADT.month_alarm = 0;
-+ }
-+
-+ cmos_rtc.day_alrm = acpi_gbl_FADT.day_alarm;
-+ cmos_rtc.mon_alrm = acpi_gbl_FADT.month_alarm;
-+ cmos_rtc.century = acpi_gbl_FADT.century;
-+
-+ if (acpi_gbl_FADT.flags & ACPI_FADT_S4_RTC_WAKE)
-+ dev_info(dev, "RTC can wake from S4\n");
-+
-+ /* RTC always wakes from S1/S2/S3, and often S4/STD */
-+ device_init_wakeup(dev, 1);
-+}
-+
-+static void cmos_check_acpi_rtc_status(struct device *dev,
-+ unsigned char *rtc_control)
-+{
-+ struct cmos_rtc *cmos = dev_get_drvdata(dev);
-+ acpi_event_status rtc_status;
-+ acpi_status status;
-+
-+ if (acpi_gbl_FADT.flags & ACPI_FADT_FIXED_RTC)
-+ return;
-+
-+ status = acpi_get_event_status(ACPI_EVENT_RTC, &rtc_status);
-+ if (ACPI_FAILURE(status)) {
-+ dev_err(dev, "Could not get RTC status\n");
-+ } else if (rtc_status & ACPI_EVENT_FLAG_SET) {
-+ unsigned char mask;
-+ *rtc_control &= ~RTC_AIE;
-+ CMOS_WRITE(*rtc_control, RTC_CONTROL);
-+ mask = CMOS_READ(RTC_INTR_FLAGS);
-+ rtc_update_irq(cmos->rtc, 1, mask);
-+ }
-+}
-+
-+#else /* !CONFIG_ACPI */
-+
-+static inline void rtc_wake_setup(struct device *dev)
-+{
-+}
-+
-+static inline void cmos_wake_setup(struct device *dev)
-+{
-+}
-+
-+static inline void cmos_check_acpi_rtc_status(struct device *dev,
-+ unsigned char *rtc_control)
-+{
-+}
-+#endif /* CONFIG_ACPI */
-
- #ifdef CONFIG_PNP
- #define INITSECTION
-@@ -1083,9 +1230,6 @@ static void cmos_check_wkalrm(struct device *dev)
- }
- }
-
--static void cmos_check_acpi_rtc_status(struct device *dev,
-- unsigned char *rtc_control);
--
- static int __maybe_unused cmos_resume(struct device *dev)
- {
- struct cmos_rtc *cmos = dev_get_drvdata(dev);
-@@ -1152,156 +1296,6 @@ static SIMPLE_DEV_PM_OPS(cmos_pm_ops, cmos_suspend, cmos_resume);
- * predate even PNPBIOS should set up platform_bus devices.
- */
-
--#ifdef CONFIG_ACPI
--
--#include <linux/acpi.h>
--
--static u32 rtc_handler(void *context)
--{
-- struct device *dev = context;
-- struct cmos_rtc *cmos = dev_get_drvdata(dev);
-- unsigned char rtc_control = 0;
-- unsigned char rtc_intr;
-- unsigned long flags;
--
--
-- /*
-- * Always update rtc irq when ACPI is used as RTC Alarm.
-- * Or else, ACPI SCI is enabled during suspend/resume only,
-- * update rtc irq in that case.
-- */
-- if (cmos_use_acpi_alarm())
-- cmos_interrupt(0, (void *)cmos->rtc);
-- else {
-- /* Fix me: can we use cmos_interrupt() here as well? */
-- spin_lock_irqsave(&rtc_lock, flags);
-- if (cmos_rtc.suspend_ctrl)
-- rtc_control = CMOS_READ(RTC_CONTROL);
-- if (rtc_control & RTC_AIE) {
-- cmos_rtc.suspend_ctrl &= ~RTC_AIE;
-- CMOS_WRITE(rtc_control, RTC_CONTROL);
-- rtc_intr = CMOS_READ(RTC_INTR_FLAGS);
-- rtc_update_irq(cmos->rtc, 1, rtc_intr);
-- }
-- spin_unlock_irqrestore(&rtc_lock, flags);
-- }
--
-- pm_wakeup_hard_event(dev);
-- acpi_clear_event(ACPI_EVENT_RTC);
-- acpi_disable_event(ACPI_EVENT_RTC, 0);
-- return ACPI_INTERRUPT_HANDLED;
--}
--
--static inline void rtc_wake_setup(struct device *dev)
--{
-- if (acpi_disabled)
-- return;
--
-- acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, dev);
-- /*
-- * After the RTC handler is installed, the Fixed_RTC event should
-- * be disabled. Only when the RTC alarm is set will it be enabled.
-- */
-- acpi_clear_event(ACPI_EVENT_RTC);
-- acpi_disable_event(ACPI_EVENT_RTC, 0);
--}
--
--static void rtc_wake_on(struct device *dev)
--{
-- acpi_clear_event(ACPI_EVENT_RTC);
-- acpi_enable_event(ACPI_EVENT_RTC, 0);
--}
--
--static void rtc_wake_off(struct device *dev)
--{
-- acpi_disable_event(ACPI_EVENT_RTC, 0);
--}
--
--#ifdef CONFIG_X86
--/* Enable use_acpi_alarm mode for Intel platforms no earlier than 2015 */
--static void use_acpi_alarm_quirks(void)
--{
-- if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
-- return;
--
-- if (!is_hpet_enabled())
-- return;
--
-- if (dmi_get_bios_year() < 2015)
-- return;
--
-- use_acpi_alarm = true;
--}
--#else
--static inline void use_acpi_alarm_quirks(void) { }
--#endif
--
--static void cmos_wake_setup(struct device *dev)
--{
-- if (acpi_disabled)
-- return;
--
-- use_acpi_alarm_quirks();
--
-- cmos_rtc.wake_on = rtc_wake_on;
-- cmos_rtc.wake_off = rtc_wake_off;
--
-- /* ACPI tables bug workaround. */
-- if (acpi_gbl_FADT.month_alarm && !acpi_gbl_FADT.day_alarm) {
-- dev_dbg(dev, "bogus FADT month_alarm (%d)\n",
-- acpi_gbl_FADT.month_alarm);
-- acpi_gbl_FADT.month_alarm = 0;
-- }
--
-- cmos_rtc.day_alrm = acpi_gbl_FADT.day_alarm;
-- cmos_rtc.mon_alrm = acpi_gbl_FADT.month_alarm;
-- cmos_rtc.century = acpi_gbl_FADT.century;
--
-- if (acpi_gbl_FADT.flags & ACPI_FADT_S4_RTC_WAKE)
-- dev_info(dev, "RTC can wake from S4\n");
--
-- /* RTC always wakes from S1/S2/S3, and often S4/STD */
-- device_init_wakeup(dev, 1);
--}
--
--static void cmos_check_acpi_rtc_status(struct device *dev,
-- unsigned char *rtc_control)
--{
-- struct cmos_rtc *cmos = dev_get_drvdata(dev);
-- acpi_event_status rtc_status;
-- acpi_status status;
--
-- if (acpi_gbl_FADT.flags & ACPI_FADT_FIXED_RTC)
-- return;
--
-- status = acpi_get_event_status(ACPI_EVENT_RTC, &rtc_status);
-- if (ACPI_FAILURE(status)) {
-- dev_err(dev, "Could not get RTC status\n");
-- } else if (rtc_status & ACPI_EVENT_FLAG_SET) {
-- unsigned char mask;
-- *rtc_control &= ~RTC_AIE;
-- CMOS_WRITE(*rtc_control, RTC_CONTROL);
-- mask = CMOS_READ(RTC_INTR_FLAGS);
-- rtc_update_irq(cmos->rtc, 1, mask);
-- }
--}
--
--#else
--
--static void cmos_wake_setup(struct device *dev)
--{
--}
--
--static void cmos_check_acpi_rtc_status(struct device *dev,
-- unsigned char *rtc_control)
--{
--}
--
--static void rtc_wake_setup(struct device *dev)
--{
--}
--#endif
--
- #ifdef CONFIG_PNP
-
- #include <linux/pnp.h>
---
-2.35.1
-
+++ /dev/null
-From 23376b7e939681259de40cc0972aeb24db288fbc Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 18 Oct 2022 22:35:11 +0200
-Subject: rtc: cmos: fix build on non-ACPI platforms
-
-From: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
-[ Upstream commit db4e955ae333567dea02822624106c0b96a2f84f ]
-
-Now that rtc_wake_setup is called outside of cmos_wake_setup, it also need
-to be defined on non-ACPI platforms.
-
-Reported-by: kernel test robot <lkp@intel.com>
-Link: https://lore.kernel.org/r/20221018203512.2532407-1-alexandre.belloni@bootlin.com
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index e5f752ce28f9..3e9168cfbe5c 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -1289,6 +1289,9 @@ static void cmos_check_acpi_rtc_status(struct device *dev,
- {
- }
-
-+static void rtc_wake_setup(struct device *dev)
-+{
-+}
- #endif
-
- #ifdef CONFIG_PNP
---
-2.35.1
-
+++ /dev/null
-From 1d849e6cf7ad36abc5669345ba6982289bff2321 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 12 Oct 2022 20:07:01 +0200
-Subject: rtc: cmos: Fix event handler registration ordering issue
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit 4919d3eb2ec0ee364f7e3cf2d99646c1b224fae8 ]
-
-Because acpi_install_fixed_event_handler() enables the event
-automatically on success, it is incorrect to call it before the
-handler routine passed to it is ready to handle events.
-
-Unfortunately, the rtc-cmos driver does exactly the incorrect thing
-by calling cmos_wake_setup(), which passes rtc_handler() to
-acpi_install_fixed_event_handler(), before cmos_do_probe(), because
-rtc_handler() uses dev_get_drvdata() to get to the cmos object
-pointer and the driver data pointer is only populated in
-cmos_do_probe().
-
-This leads to a NULL pointer dereference in rtc_handler() on boot
-if the RTC fixed event happens to be active at the init time.
-
-To address this issue, change the initialization ordering of the
-driver so that cmos_wake_setup() is always called after a successful
-cmos_do_probe() call.
-
-While at it, change cmos_pnp_probe() to call cmos_do_probe() after
-the initial if () statement used for computing the IRQ argument to
-be passed to cmos_do_probe() which is cleaner than calling it in
-each branch of that if () (local variable "irq" can be of type int,
-because it is passed to that function as an argument of type int).
-
-Note that commit 6492fed7d8c9 ("rtc: rtc-cmos: Do not check
-ACPI_FADT_LOW_POWER_S0") caused this issue to affect a larger number
-of systems, because previously it only affected systems with
-ACPI_FADT_LOW_POWER_S0 set, but it is present regardless of that
-commit.
-
-Fixes: 6492fed7d8c9 ("rtc: rtc-cmos: Do not check ACPI_FADT_LOW_POWER_S0")
-Fixes: a474aaedac99 ("rtc-cmos: move wake setup from ACPI glue into RTC driver")
-Link: https://lore.kernel.org/linux-acpi/20221010141630.zfzi7mk7zvnmclzy@techsingularity.net/
-Reported-by: Mel Gorman <mgorman@techsingularity.net>
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
-Tested-by: Mel Gorman <mgorman@techsingularity.net>
-Link: https://lore.kernel.org/r/5629262.DvuYhMxLoT@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 29 +++++++++++++++++++----------
- 1 file changed, 19 insertions(+), 10 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index 398b4fb8d934..5ba7de382ab2 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -1295,10 +1295,10 @@ static void cmos_check_acpi_rtc_status(struct device *dev,
-
- static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- {
-- cmos_wake_setup(&pnp->dev);
-+ int irq, ret;
-
- if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) {
-- unsigned int irq = 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
-@@ -1307,13 +1307,17 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- if (nr_legacy_irqs())
- irq = 8;
- #endif
-- return cmos_do_probe(&pnp->dev,
-- pnp_get_resource(pnp, IORESOURCE_IO, 0), irq);
- } else {
-- return cmos_do_probe(&pnp->dev,
-- pnp_get_resource(pnp, IORESOURCE_IO, 0),
-- pnp_irq(pnp, 0));
-+ irq = pnp_irq(pnp, 0);
- }
-+
-+ ret = cmos_do_probe(&pnp->dev, pnp_get_resource(pnp, IORESOURCE_IO, 0), irq);
-+ if (ret)
-+ return ret;
-+
-+ cmos_wake_setup(&pnp->dev);
-+
-+ return 0;
- }
-
- static void cmos_pnp_remove(struct pnp_dev *pnp)
-@@ -1397,10 +1401,9 @@ static inline void cmos_of_init(struct platform_device *pdev) {}
- static int __init cmos_platform_probe(struct platform_device *pdev)
- {
- struct resource *resource;
-- int irq;
-+ int irq, ret;
-
- cmos_of_init(pdev);
-- cmos_wake_setup(&pdev->dev);
-
- if (RTC_IOMAPPED)
- resource = platform_get_resource(pdev, IORESOURCE_IO, 0);
-@@ -1410,7 +1413,13 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
- if (irq < 0)
- irq = -1;
-
-- return cmos_do_probe(&pdev->dev, resource, irq);
-+ ret = cmos_do_probe(&pdev->dev, resource, irq);
-+ if (ret)
-+ return ret;
-+
-+ cmos_wake_setup(&pdev->dev);
-+
-+ return 0;
- }
-
- static int cmos_platform_remove(struct platform_device *pdev)
---
-2.35.1
-
+++ /dev/null
-From 9d26123b8f35fea9f3dc945a5df9966b34c1030c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 18 Oct 2022 18:09:31 +0200
-Subject: rtc: cmos: Fix wake alarm breakage
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit 0782b66ed2fbb035dda76111df0954515e417b24 ]
-
-Commit 4919d3eb2ec0 ("rtc: cmos: Fix event handler registration
-ordering issue") overlooked the fact that cmos_do_probe() depended
-on the preparations carried out by cmos_wake_setup() and the wake
-alarm stopped working after the ordering of them had been changed.
-
-Address this by partially reverting commit 4919d3eb2ec0 so that
-cmos_wake_setup() is called before cmos_do_probe() again and moving
-the rtc_wake_setup() invocation from cmos_wake_setup() directly to the
-callers of cmos_do_probe() where it will happen after a successful
-completion of the latter.
-
-Fixes: 4919d3eb2ec0 ("rtc: cmos: Fix event handler registration ordering issue")
-Reported-by: Zhang Rui <rui.zhang@intel.com>
-Reported-by: Todd Brandt <todd.e.brandt@linux.intel.com>
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Link: https://lore.kernel.org/r/5887691.lOV4Wx5bFT@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index 5ba7de382ab2..e5f752ce28f9 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -1176,6 +1176,9 @@ static u32 rtc_handler(void *context)
-
- static inline void rtc_wake_setup(struct device *dev)
- {
-+ if (acpi_disabled)
-+ return;
-+
- acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, dev);
- /*
- * After the RTC handler is installed, the Fixed_RTC event should
-@@ -1229,7 +1232,6 @@ static void cmos_wake_setup(struct device *dev)
-
- use_acpi_alarm_quirks();
-
-- rtc_wake_setup(dev);
- acpi_rtc_info.wake_on = rtc_wake_on;
- acpi_rtc_info.wake_off = rtc_wake_off;
-
-@@ -1297,6 +1299,8 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- {
- int irq, ret;
-
-+ cmos_wake_setup(&pnp->dev);
-+
- if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) {
- irq = 0;
- #ifdef CONFIG_X86
-@@ -1315,7 +1319,7 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
- if (ret)
- return ret;
-
-- cmos_wake_setup(&pnp->dev);
-+ rtc_wake_setup(&pnp->dev);
-
- return 0;
- }
-@@ -1404,6 +1408,7 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
- int irq, ret;
-
- cmos_of_init(pdev);
-+ cmos_wake_setup(&pdev->dev);
-
- if (RTC_IOMAPPED)
- resource = platform_get_resource(pdev, IORESOURCE_IO, 0);
-@@ -1417,7 +1422,7 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
- if (ret)
- return ret;
-
-- cmos_wake_setup(&pdev->dev);
-+ rtc_wake_setup(&pdev->dev);
-
- return 0;
- }
---
-2.35.1
-
+++ /dev/null
-From 580ea6ef977ad83e0e2e37db9dc68b9ed4d6f534 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 23 Jan 2020 15:14:37 +0200
-Subject: rtc: cmos: Refactor code by using the new dmi_get_bios_year() helper
-
-From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
-[ Upstream commit 604c521259c8051b7607c000eda7938f7a705d92 ]
-
-Refactor code by using the new dmi_get_bios_year() helper instead of
-open coding its functionality. This also makes logic slightly clearer.
-
-No changes intended.
-
-Cc: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Tested-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
-Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-Link: https://lore.kernel.org/r/20200123131437.28157-3-andriy.shevchenko@linux.intel.com
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index c0dc03ffa817..60271ea2a28d 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -1200,8 +1200,6 @@ static void rtc_wake_off(struct device *dev)
- /* Enable use_acpi_alarm mode for Intel platforms no earlier than 2015 */
- static void use_acpi_alarm_quirks(void)
- {
-- int year;
--
- if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
- return;
-
-@@ -1211,8 +1209,10 @@ static void use_acpi_alarm_quirks(void)
- if (!is_hpet_enabled())
- return;
-
-- if (dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL) && year >= 2015)
-- use_acpi_alarm = true;
-+ if (dmi_get_bios_year() < 2015)
-+ return;
-+
-+ use_acpi_alarm = true;
- }
- #else
- static inline void use_acpi_alarm_quirks(void) { }
---
-2.35.1
-
+++ /dev/null
-From 1eda1ed7aed77f58f5b1a3eb18ba1037a1800e8e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 9 Nov 2022 13:12:00 +0100
-Subject: rtc: cmos: Rename ACPI-related functions
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit d13e9ad9f5146f066a5c5a1cc993d09e4fb21ead ]
-
-The names of rtc_wake_setup() and cmos_wake_setup() don't indicate
-that these functions are ACPI-related, which is the case, and the
-former doesn't really reflect the role of the function.
-
-Rename them to acpi_rtc_event_setup() and acpi_cmos_wake_setup(),
-respectively, to address this shortcoming.
-
-No intentional functional impact.
-
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Zhang Rui <rui.zhang@intel.com>
-Tested-by: Zhang Rui <rui.zhang@intel.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/3225614.44csPzL39Z@kreacher
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index bc8f65014025..203f41afe8c1 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -738,7 +738,7 @@ static u32 rtc_handler(void *context)
- return ACPI_INTERRUPT_HANDLED;
- }
-
--static void rtc_wake_setup(struct device *dev)
-+static void acpi_rtc_event_setup(struct device *dev)
- {
- if (acpi_disabled)
- return;
-@@ -782,7 +782,7 @@ static void use_acpi_alarm_quirks(void)
- static inline void use_acpi_alarm_quirks(void) { }
- #endif
-
--static void cmos_wake_setup(struct device *dev)
-+static void acpi_cmos_wake_setup(struct device *dev)
- {
- if (acpi_disabled)
- return;
-@@ -834,11 +834,11 @@ static void cmos_check_acpi_rtc_status(struct device *dev,
-
- #else /* !CONFIG_ACPI */
-
--static inline void rtc_wake_setup(struct device *dev)
-+static inline void acpi_rtc_event_setup(struct device *dev)
- {
- }
-
--static inline void cmos_wake_setup(struct device *dev)
-+static inline void acpi_cmos_wake_setup(struct device *dev)
- {
- }
-
-@@ -940,7 +940,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
- cmos_rtc.wake_off = info->wake_off;
- }
- } else {
-- cmos_wake_setup(dev);
-+ acpi_cmos_wake_setup(dev);
- }
-
- if (cmos_rtc.day_alrm >= 128)
-@@ -1038,7 +1038,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
- * the ACPI RTC fixed event.
- */
- if (!info)
-- rtc_wake_setup(dev);
-+ acpi_rtc_event_setup(dev);
-
- dev_info(dev, "%s%s, %d bytes nvram%s\n",
- !is_valid_irq(rtc_irq) ? "no alarms" :
---
-2.35.1
-
+++ /dev/null
-From 3870d76e5891bf7a187273dfb80fb21c6ccb955d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 8 Aug 2022 20:23:59 +0200
-Subject: rtc: rtc-cmos: Do not check ACPI_FADT_LOW_POWER_S0
-
-From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
-[ Upstream commit 6492fed7d8c95f53b0b804ef541324d924d95d41 ]
-
-The ACPI_FADT_LOW_POWER_S0 flag merely means that it is better to
-use low-power S0 idle on the given platform than S3 (provided that
-the latter is supported) and it doesn't preclude using either of
-them (which of them will be used depends on the choices made by user
-space).
-
-For this reason, there is no benefit from checking that flag in
-use_acpi_alarm_quirks().
-
-First off, it cannot be a bug to do S3 with use_acpi_alarm set,
-because S3 can be used on systems with ACPI_FADT_LOW_POWER_S0 and it
-must work if really supported, so the ACPI_FADT_LOW_POWER_S0 check is
-not needed to protect the S3-capable systems from failing.
-
-Second, suspend-to-idle can be carried out on a system with
-ACPI_FADT_LOW_POWER_S0 unset and it is expected to work, so if setting
-use_acpi_alarm is needed to handle that case correctly, it should be
-set regardless of the ACPI_FADT_LOW_POWER_S0 value.
-
-Accordingly, drop the ACPI_FADT_LOW_POWER_S0 check from
-use_acpi_alarm_quirks().
-
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Link: https://lore.kernel.org/r/12054246.O9o76ZdvQC@kreacher
-Stable-dep-of: 83ebb7b3036d ("rtc: cmos: Disable ACPI RTC event on removal")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/rtc/rtc-cmos.c | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index 60271ea2a28d..398b4fb8d934 100644
---- a/drivers/rtc/rtc-cmos.c
-+++ b/drivers/rtc/rtc-cmos.c
-@@ -1203,9 +1203,6 @@ static void use_acpi_alarm_quirks(void)
- if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
- return;
-
-- if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
-- return;
--
- if (!is_hpet_enabled())
- return;
-
---
-2.35.1
-
power-supply-fix-null-pointer-dereferencing-in-power.patch
rdma-siw-fix-pointer-cast-warning.patch
include-uapi-linux-swab-fix-potentially-missing-__al.patch
-rtc-cmos-refactor-code-by-using-the-new-dmi_get_bios.patch
-rtc-rtc-cmos-do-not-check-acpi_fadt_low_power_s0.patch
-rtc-cmos-fix-event-handler-registration-ordering-iss.patch
-rtc-cmos-fix-wake-alarm-breakage.patch
-rtc-cmos-fix-build-on-non-acpi-platforms.patch
-rtc-cmos-call-cmos_wake_setup-from-cmos_do_probe.patch
-rtc-cmos-call-rtc_wake_setup-from-cmos_do_probe.patch
-rtc-cmos-eliminate-forward-declarations-of-some-func.patch
-rtc-cmos-rename-acpi-related-functions.patch
-rtc-cmos-disable-acpi-rtc-event-on-removal.patch
rtc-snvs-allow-a-time-difference-on-clock-register-r.patch
rtc-pcf85063-fix-reading-alarm.patch
iommu-amd-fix-pci-device-refcount-leak-in-ppr_notifi.patch