]> git.baikalelectronics.ru Git - kernel.git/commit
alarmtimer: Make alarmtimer platform device child of RTC device
authorStephen Boyd <swboyd@chromium.org>
Fri, 24 Jan 2020 05:58:46 +0000 (21:58 -0800)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 24 Jan 2020 20:00:20 +0000 (21:00 +0100)
commit8b13dea84e93a2d930e4dc1ab3fb550517815020
treecf4e052720b13762b461e2e287eaa3d1d86256d8
parentff531ab8af8284a82b4f2f588ec65faeb4e7f83e
alarmtimer: Make alarmtimer platform device child of RTC device

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.

Move the alarmtimer device registration to happen when the RTC which is
used for wakeup is registered. Register the 'alarmtimer' platform device as
a child of the RTC device too, so that it can be guaranteed that the RTC
device won't be suspended when alarmtimer_suspend() is called.

Reported-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20200124055849.154411-2-swboyd@chromium.org
kernel/time/alarmtimer.c