]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: interface: ignore expired timers when enqueuing new timers
authorColin Ian King <colin.king@canonical.com>
Mon, 16 May 2016 16:22:54 +0000 (17:22 +0100)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Sat, 4 Jun 2016 13:43:22 +0000 (15:43 +0200)
commitfed8a941785a42b2b9c56850a9a551b69de2254b
treefd6c31f7d35b9c4b97554497028a06241469e9cb
parent3b190bff5d54f392d6ce61fb29cf265775629980
rtc: interface: ignore expired timers when enqueuing new timers

This patch fixes a RTC wakealarm issue, namely, the event fires during
hibernate and is not cleared from the list, causing hwclock to block.

The current enqueuing does not trigger an alarm if any expired timers
already exist on the timerqueue. This can occur when a RTC wake alarm
is used to wake a machine out of hibernate and the resumed state has
old expired timers that have not been removed from the timer queue.
This fix skips over any expired timers and triggers an alarm if there
are no pending timers on the timerqueue. Note that the skipped expired
timer will get reaped later on, so there is no need to clean it up
immediately.

The issue can be reproduced by putting a machine into hibernate and
waking it with the RTC wakealarm.  Running the example RTC test program
from tools/testing/selftests/timers/rtctest.c after the hibernate will
block indefinitely.  With the fix, it no longer blocks after the
hibernate resume.

BugLink: http://bugs.launchpad.net/bugs/1333569
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/interface.c