Skip to content

Commit 0782b66

Browse files
rafaeljwalexandrebelloni
authored andcommitted
rtc: cmos: Fix wake alarm breakage
Commit 4919d3e ("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 4919d3e 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: 4919d3e ("rtc: cmos: Fix event handler registration ordering issue") Reported-by: Zhang Rui <[email protected]> Reported-by: Todd Brandt <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/5887691.lOV4Wx5bFT@kreacher Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 9abf231 commit 0782b66

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/rtc/rtc-cmos.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,9 @@ static u32 rtc_handler(void *context)
12331233

12341234
static inline void rtc_wake_setup(struct device *dev)
12351235
{
1236+
if (acpi_disabled)
1237+
return;
1238+
12361239
acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, dev);
12371240
/*
12381241
* After the RTC handler is installed, the Fixed_RTC event should
@@ -1286,7 +1289,6 @@ static void cmos_wake_setup(struct device *dev)
12861289

12871290
use_acpi_alarm_quirks();
12881291

1289-
rtc_wake_setup(dev);
12901292
acpi_rtc_info.wake_on = rtc_wake_on;
12911293
acpi_rtc_info.wake_off = rtc_wake_off;
12921294

@@ -1354,6 +1356,8 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
13541356
{
13551357
int irq, ret;
13561358

1359+
cmos_wake_setup(&pnp->dev);
1360+
13571361
if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) {
13581362
irq = 0;
13591363
#ifdef CONFIG_X86
@@ -1372,7 +1376,7 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
13721376
if (ret)
13731377
return ret;
13741378

1375-
cmos_wake_setup(&pnp->dev);
1379+
rtc_wake_setup(&pnp->dev);
13761380

13771381
return 0;
13781382
}
@@ -1461,6 +1465,7 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
14611465
int irq, ret;
14621466

14631467
cmos_of_init(pdev);
1468+
cmos_wake_setup(&pdev->dev);
14641469

14651470
if (RTC_IOMAPPED)
14661471
resource = platform_get_resource(pdev, IORESOURCE_IO, 0);
@@ -1474,7 +1479,7 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
14741479
if (ret)
14751480
return ret;
14761481

1477-
cmos_wake_setup(&pdev->dev);
1482+
rtc_wake_setup(&pdev->dev);
14781483

14791484
return 0;
14801485
}

0 commit comments

Comments
 (0)