Re: [PATCH v2 1/3] alarmtimer: Make alarmtimer platform device child of RTC device

From: Doug Anderson
Date: Tue Jan 21 2020 - 18:43:49 EST


Hi,

On Tue, Jan 21, 2020 at 11:48 AM Stephen Boyd <swboyd@xxxxxxxxxxxx> wrote:
>
> The alarmtimer_suspend() function will fail if an RTC device is on a bus
> such as SPI or i2c and that RTC device registers and probes after
> alarmtimer_init() registers and probes the 'alarmtimer' platform device.
> This is because system wide suspend suspends devices in the reverse
> order of their probe. When alarmtimer_suspend() attempts to program the
> RTC for a wakeup it will try to program an RTC device on a bus that has
> already been suspended.
>
> Let's move the alarmtimer device registration to be when the RTC we use
> for wakeup is registered. Register the 'alarmtimer' platform device as a
> child of the RTC device too, so that we can be guaranteed that the RTC
> device won't be suspended when alarmtimer_suspend() is called.
>
> Reported-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
> Signed-off-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
> ---
> kernel/time/alarmtimer.c | 20 +++++++++-----------
> 1 file changed, 9 insertions(+), 11 deletions(-)

Other than the extra space that you pointed out yourself (which maybe
could be fixed when applying to avoid an extra spin), this looks nice
to me.

With the caveat that I'm not an expert in this part of the code:

Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>