aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/interface.c')
-rw-r--r--drivers/rtc/interface.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 8cec9a02c0b8..672b192f8153 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -779,7 +779,7 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer)
779 } 779 }
780 780
781 timerqueue_add(&rtc->timerqueue, &timer->node); 781 timerqueue_add(&rtc->timerqueue, &timer->node);
782 if (!next) { 782 if (!next || ktime_before(timer->node.expires, next->expires)) {
783 struct rtc_wkalrm alarm; 783 struct rtc_wkalrm alarm;
784 int err; 784 int err;
785 alarm.time = rtc_ktime_to_tm(timer->node.expires); 785 alarm.time = rtc_ktime_to_tm(timer->node.expires);
@@ -1004,6 +1004,10 @@ int rtc_read_offset(struct rtc_device *rtc, long *offset)
1004 * to compensate for differences in the actual clock rate due to temperature, 1004 * to compensate for differences in the actual clock rate due to temperature,
1005 * the crystal, capacitor, etc. 1005 * the crystal, capacitor, etc.
1006 * 1006 *
1007 * The adjustment applied is as follows:
1008 * t = t0 * (1 + offset * 1e-9)
1009 * where t0 is the measured length of 1 RTC second with offset = 0
1010 *
1007 * Kernel interface to adjust an rtc clock offset. 1011 * Kernel interface to adjust an rtc clock offset.
1008 * Return 0 on success, or a negative number on error. 1012 * Return 0 on success, or a negative number on error.
1009 * If the rtc offset is not setable (or not implemented), return -EINVAL 1013 * If the rtc offset is not setable (or not implemented), return -EINVAL