[tip:timers/core] rtc: Expire alarms after the time is set. (v2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  5f9679d29c7959445d4af1eb85ee55e4ebad4a93
Gitweb:     http://git.kernel.org/tip/5f9679d29c7959445d4af1eb85ee55e4ebad4a93
Author:     NeilBrown <neilb@xxxxxxx>
AuthorDate: Fri, 9 Dec 2011 09:39:15 +1100
Committer:  John Stultz <john.stultz@xxxxxxxxxx>
CommitDate: Thu, 26 Jan 2012 19:41:36 -0800

rtc: Expire alarms after the time is set. (v2)

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 is done whenever the RTC clock is set.

This is the second revision of this patch, which was earlier reverted.
This version avoids the initialization problem, which is handled by
a different patch.

Tested-by: Sander Eikelenboom <linux@xxxxxxxxxxxxxx>
Signed-off-by: NeilBrown <neilb@xxxxxxx>
[Remove problematic initialization change, update commit log, also
catch set_mmss case -jstultz]
Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
---
 drivers/rtc/interface.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index c55a160..167e68a 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;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux