summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown2011-12-08 23:39:15 +0100
committerJohn Stultz2011-12-13 21:26:11 +0100
commit93b2ec0128c431148b216b8f7337c1a52131ef03 (patch)
tree0782370c8c04c182e67b26414e3d4180616db94b
parentalarmtimers: Fix time comparison (diff)
downloadkernel-qcow2-linux-93b2ec0128c431148b216b8f7337c1a52131ef03.tar.gz
kernel-qcow2-linux-93b2ec0128c431148b216b8f7337c1a52131ef03.tar.xz
kernel-qcow2-linux-93b2ec0128c431148b216b8f7337c1a52131ef03.zip
rtc: Expire alarms after the time is set.
If the alarm time programming in the rtc is ever in the past, it won't fire, and any other alarm will be queued after it so they won't fire either. So any time that the alarm might be in the past, we need to trigger the irq handler to ensure the old alarm is cleared and the timer queue is fully in the future. This can happen: - when we first initialise the alarm - when we set the time in the rtc. so follow both of these by scheduling the timer work function. CC: stable@kernel.org Signed-off-by: NeilBrown <neilb@suse.de> [Also catch set_mmss case -jstultz] Signed-off-by: John Stultz <john.stultz@linaro.org>
-rw-r--r--drivers/rtc/interface.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index fa4d9f324189..3bcc7cfcaba7 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -73,6 +73,8 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
err = -EINVAL;
mutex_unlock(&rtc->ops_lock);
+ /* A timer might have just expired */
+ schedule_work(&rtc->irqwork);
return err;
}
EXPORT_SYMBOL_GPL(rtc_set_time);
@@ -112,6 +114,8 @@ int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs)
err = -EINVAL;
mutex_unlock(&rtc->ops_lock);
+ /* A timer might have just expired */
+ schedule_work(&rtc->irqwork);
return err;
}
@@ -403,6 +407,8 @@ int rtc_initialize_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
timerqueue_add(&rtc->timerqueue, &rtc->aie_timer.node);
}
mutex_unlock(&rtc->ops_lock);
+ /* maybe that was in the past.*/
+ schedule_work(&rtc->irqwork);
return err;
}
EXPORT_SYMBOL_GPL(rtc_initialize_alarm);