Skip to content

Commit d6752e1

Browse files
bebarinoalexandrebelloni
authored andcommitted
rtc: cros-ec: Fail suspend/resume if wake IRQ can't be configured
If we encounter a failure during suspend where this RTC was programmed to wakeup the system from suspend, but that wakeup couldn't be configured because the system didn't support wakeup interrupts, we'll run into the following warning: Unbalanced IRQ 166 wake disable WARNING: CPU: 7 PID: 3071 at kernel/irq/manage.c:669 irq_set_irq_wake+0x108/0x278 This happens because the suspend process isn't aborted when the RTC fails to configure the wakeup IRQ. Instead, we continue suspending the system and then another suspend callback fails the suspend process and "unwinds" the previously suspended drivers by calling their resume callbacks. When we get back to resuming this RTC driver, we'll call disable_irq_wake() on an IRQ that hasn't been configured for wake. Let's just fail suspend/resume here if we can't configure the system to wake and the user has chosen to wakeup with this device. This fixes this warning and makes the code more robust in case there are systems out there that can't wakeup from suspend on this line but the user has chosen to do so. Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com> Cc: Evan Green <evgreen@chromium.org> Cc: Benson Leung <bleung@chromium.org> Cc: Guenter Roeck <groeck@chromium.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Acked-By: Benson Leung <bleung@chromium.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 9e98c67 commit d6752e1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/rtc/rtc-cros-ec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ static int cros_ec_rtc_suspend(struct device *dev)
298298
struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev);
299299

300300
if (device_may_wakeup(dev))
301-
enable_irq_wake(cros_ec_rtc->cros_ec->irq);
301+
return enable_irq_wake(cros_ec_rtc->cros_ec->irq);
302302

303303
return 0;
304304
}
@@ -309,7 +309,7 @@ static int cros_ec_rtc_resume(struct device *dev)
309309
struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev);
310310

311311
if (device_may_wakeup(dev))
312-
disable_irq_wake(cros_ec_rtc->cros_ec->irq);
312+
return disable_irq_wake(cros_ec_rtc->cros_ec->irq);
313313

314314
return 0;
315315
}

0 commit comments

Comments
 (0)