]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/5.0.14/rtc-cros-ec-fail-suspend-resume-if-wake-irq-can-t-be.patch
Linux 4.19.41
[thirdparty/kernel/stable-queue.git] / releases / 5.0.14 / rtc-cros-ec-fail-suspend-resume-if-wake-irq-can-t-be.patch
1 From 53de23c15ec8c07999afb17f411c5d98a78031c5 Mon Sep 17 00:00:00 2001
2 From: Stephen Boyd <swboyd@chromium.org>
3 Date: Fri, 15 Mar 2019 11:51:12 -0700
4 Subject: rtc: cros-ec: Fail suspend/resume if wake IRQ can't be configured
5
6 [ Upstream commit d6752e185c3168771787a02dc6a55f32260943cc ]
7
8 If we encounter a failure during suspend where this RTC was programmed
9 to wakeup the system from suspend, but that wakeup couldn't be
10 configured because the system didn't support wakeup interrupts, we'll
11 run into the following warning:
12
13 Unbalanced IRQ 166 wake disable
14 WARNING: CPU: 7 PID: 3071 at kernel/irq/manage.c:669 irq_set_irq_wake+0x108/0x278
15
16 This happens because the suspend process isn't aborted when the RTC
17 fails to configure the wakeup IRQ. Instead, we continue suspending the
18 system and then another suspend callback fails the suspend process and
19 "unwinds" the previously suspended drivers by calling their resume
20 callbacks. When we get back to resuming this RTC driver, we'll call
21 disable_irq_wake() on an IRQ that hasn't been configured for wake.
22
23 Let's just fail suspend/resume here if we can't configure the system to
24 wake and the user has chosen to wakeup with this device. This fixes this
25 warning and makes the code more robust in case there are systems out
26 there that can't wakeup from suspend on this line but the user has
27 chosen to do so.
28
29 Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
30 Cc: Evan Green <evgreen@chromium.org>
31 Cc: Benson Leung <bleung@chromium.org>
32 Cc: Guenter Roeck <groeck@chromium.org>
33 Signed-off-by: Stephen Boyd <swboyd@chromium.org>
34 Acked-By: Benson Leung <bleung@chromium.org>
35 Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
36 Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
37 ---
38 drivers/rtc/rtc-cros-ec.c | 4 ++--
39 1 file changed, 2 insertions(+), 2 deletions(-)
40
41 diff --git a/drivers/rtc/rtc-cros-ec.c b/drivers/rtc/rtc-cros-ec.c
42 index e5444296075e..4d6bf9304ceb 100644
43 --- a/drivers/rtc/rtc-cros-ec.c
44 +++ b/drivers/rtc/rtc-cros-ec.c
45 @@ -298,7 +298,7 @@ static int cros_ec_rtc_suspend(struct device *dev)
46 struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev);
47
48 if (device_may_wakeup(dev))
49 - enable_irq_wake(cros_ec_rtc->cros_ec->irq);
50 + return enable_irq_wake(cros_ec_rtc->cros_ec->irq);
51
52 return 0;
53 }
54 @@ -309,7 +309,7 @@ static int cros_ec_rtc_resume(struct device *dev)
55 struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev);
56
57 if (device_may_wakeup(dev))
58 - disable_irq_wake(cros_ec_rtc->cros_ec->irq);
59 + return disable_irq_wake(cros_ec_rtc->cros_ec->irq);
60
61 return 0;
62 }
63 --
64 2.20.1
65