aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-sysfs.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2008-02-06 04:38:45 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:13 -0500
commit8a0bdfd7a05f5bb0486fbe7146a2cf775957e95e (patch)
tree2de49bb837ef636cd07c10ef7773194731f412da /drivers/rtc/rtc-sysfs.c
parent739d340dba45ab786a5553144bbffbee0afe15dd (diff)
rtc-cmos alarm acts as oneshot
Start making the rtc-cmos alarm act more like a oneshot alarm by disabling that alarm after its IRQ fires. (ACPI hooks are also needed.) The Linux RTC framework has previously been a bit vague in this area, but any other behavior is problematic and not very portable. RTCs with full YYYY-MM-DD HH:MM[:SS] alarms won't have a problem here. Only ones with partial match criteria, with the most visible example being the PC RTC, get confused. (Because the criteria will match repeatedly.) Update comments relating to that oneshot behavior and timezone handling. (Timezones are another issue that's mostly visible with rtc-cmos. That's because PCs often dual-boot MS-Windows, which likes its RTC to match local wall-clock time instead of UTC.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-sysfs.c')
-rw-r--r--drivers/rtc/rtc-sysfs.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c
index 2ae0e8304d3a..4d27ccc4fc06 100644
--- a/drivers/rtc/rtc-sysfs.c
+++ b/drivers/rtc/rtc-sysfs.c
@@ -17,6 +17,13 @@
17 17
18/* device attributes */ 18/* device attributes */
19 19
20/*
21 * NOTE: RTC times displayed in sysfs use the RTC's timezone. That's
22 * ideally UTC. However, PCs that also boot to MS-Windows normally use
23 * the local time and change to match daylight savings time. That affects
24 * attributes including date, time, since_epoch, and wakealarm.
25 */
26
20static ssize_t 27static ssize_t
21rtc_sysfs_show_name(struct device *dev, struct device_attribute *attr, 28rtc_sysfs_show_name(struct device *dev, struct device_attribute *attr,
22 char *buf) 29 char *buf)
@@ -113,13 +120,13 @@ rtc_sysfs_show_wakealarm(struct device *dev, struct device_attribute *attr,
113 unsigned long alarm; 120 unsigned long alarm;
114 struct rtc_wkalrm alm; 121 struct rtc_wkalrm alm;
115 122
116 /* Don't show disabled alarms; but the RTC could leave the 123 /* Don't show disabled alarms. For uniformity, RTC alarms are
117 * alarm enabled after it's already triggered. Alarms are 124 * conceptually one-shot, even though some common RTCs (on PCs)
118 * conceptually one-shot, even though some common hardware 125 * don't actually work that way.
119 * (PCs) doesn't actually work that way.
120 * 126 *
121 * REVISIT maybe we should require RTC implementations to 127 * NOTE: RTC implementations where the alarm doesn't match an
122 * disable the RTC alarm after it triggers, for uniformity. 128 * exact YYYY-MM-DD HH:MM[:SS] date *must* disable their RTC
129 * alarms after they trigger, to ensure one-shot semantics.
123 */ 130 */
124 retval = rtc_read_alarm(to_rtc_device(dev), &alm); 131 retval = rtc_read_alarm(to_rtc_device(dev), &alm);
125 if (retval == 0 && alm.enabled) { 132 if (retval == 0 && alm.enabled) {