Messages in this thread Patch in this message | | | From | Stephen Boyd <> | Subject | [PATCH 3/4] alarmtimer: Use wakeup source from alarmtimer platform device | Date | Thu, 9 Jan 2020 07:59:09 -0800 |
| |
Use the wakeup source that can be associated with the 'alarmtimer' platform device instead of registering another one by hand.
Signed-off-by: Stephen Boyd <swboyd@chromium.org> --- kernel/time/alarmtimer.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index ccb6aea4f1d4..be057638e89d 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -55,8 +55,6 @@ static DEFINE_SPINLOCK(freezer_delta_lock); #endif #ifdef CONFIG_RTC_CLASS -static struct wakeup_source *ws; - /* rtc timer and device for setting alarm wakeups at suspend */ static struct rtc_timer rtctimer; static struct rtc_device *rtcdev; @@ -87,7 +85,6 @@ static int alarmtimer_rtc_add_device(struct device *dev, { unsigned long flags; struct rtc_device *rtc = to_rtc_device(dev); - struct wakeup_source *__ws; struct platform_device *pdev; int ret = 0; @@ -99,8 +96,9 @@ static int alarmtimer_rtc_add_device(struct device *dev, if (!device_may_wakeup(rtc->dev.parent)) return -1; - __ws = wakeup_source_register(dev, "alarmtimer"); pdev = platform_device_register_data(dev, "alarmtimer", -1, NULL, 0); + if (pdev) + device_init_wakeup(&pdev->dev, true); spin_lock_irqsave(&rtcdev_lock, flags); if (!rtcdev) { @@ -112,15 +110,12 @@ static int alarmtimer_rtc_add_device(struct device *dev, rtcdev = rtc; /* hold a reference so it doesn't go away */ get_device(dev); - ws = __ws; - __ws = NULL; pdev = NULL; } unlock: spin_unlock_irqrestore(&rtcdev_lock, flags); platform_device_unregister(pdev); - wakeup_source_unregister(__ws); return ret; } @@ -287,7 +282,7 @@ static int alarmtimer_suspend(struct device *dev) return 0; if (ktime_to_ns(min) < 2 * NSEC_PER_SEC) { - __pm_wakeup_event(ws, 2 * MSEC_PER_SEC); + pm_wakeup_event(dev, 2 * MSEC_PER_SEC); return -EBUSY; } @@ -302,7 +297,7 @@ static int alarmtimer_suspend(struct device *dev) /* Set alarm, if in the past reject suspend briefly to handle */ ret = rtc_timer_start(rtc, &rtctimer, now, 0); if (ret < 0) - __pm_wakeup_event(ws, MSEC_PER_SEC); + pm_wakeup_event(dev, MSEC_PER_SEC); return ret; } -- Sent by a computer, using git, on the internet
| |