Messages in this thread | | | From | Doug Anderson <> | Date | Wed, 15 Jan 2020 11:47:49 -0800 | Subject | Re: [PATCH 3/4] alarmtimer: Use wakeup source from alarmtimer platform device |
| |
Hi,
On Thu, Jan 9, 2020 at 7:59 AM Stephen Boyd <swboyd@chromium.org> wrote: > > 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)
It appears that the error case for platform_device_register_data() needs to be checked with by IS_ERR().
Other than that, this seems like a sane idea to me and a nice cleanup. With my usual caveat that I'm reviewing code that I'm by no means an expert in, feel free to add my Reviewed-by with that change.
-Doug
| |