]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
rtc: set the alarm to the next expiring timer
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>
Thu, 28 Sep 2017 11:53:27 +0000 (13:53 +0200)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Thu, 28 Sep 2017 11:53:27 +0000 (13:53 +0200)
If there is any non expired timer in the queue, the RTC alarm is never set.
This is an issue when adding a timer that expires before the next non
expired timer.

Ensure the RTC alarm is set in that case.

Fixes: 2b2f5ff00f63 ("rtc: interface: ignore expired timers when enqueuing new timers")
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/interface.c

index 8cec9a02c0b8937fdcdca2fdd80d14dba4e79b7c..9eb32ead63dbeaa8d675c4118ff48521fcda5949 100644 (file)
@@ -779,7 +779,7 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer)
        }
 
        timerqueue_add(&rtc->timerqueue, &timer->node);
-       if (!next) {
+       if (!next || ktime_before(timer->node.expires, next->expires)) {
                struct rtc_wkalrm alarm;
                int err;
                alarm.time = rtc_ktime_to_tm(timer->node.expires);