Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83529
b: refs/heads/master
c: 8a0bdfd
h: refs/heads/master
i:
  83527: 53053bf
v: v3
  • Loading branch information
David Brownell authored and Linus Torvalds committed Feb 6, 2008
1 parent 42b89a9 commit b38b5c2
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 739d340dba45ab786a5553144bbffbee0afe15dd
refs/heads/master: 8a0bdfd7a05f5bb0486fbe7146a2cf775957e95e
14 changes: 13 additions & 1 deletion trunk/drivers/rtc/rtc-cmos.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,22 @@ static struct cmos_rtc cmos_rtc;
static irqreturn_t cmos_interrupt(int irq, void *p)
{
u8 irqstat;
u8 rtc_control;

spin_lock(&rtc_lock);
irqstat = CMOS_READ(RTC_INTR_FLAGS);
irqstat &= (CMOS_READ(RTC_CONTROL) & RTC_IRQMASK) | RTC_IRQF;
rtc_control = CMOS_READ(RTC_CONTROL);
irqstat &= (rtc_control & RTC_IRQMASK) | RTC_IRQF;

/* All Linux RTC alarms should be treated as if they were oneshot.
* Similar code may be needed in system wakeup paths, in case the
* alarm woke the system.
*/
if (irqstat & RTC_AIE) {
rtc_control &= ~RTC_AIE;
CMOS_WRITE(rtc_control, RTC_CONTROL);
CMOS_READ(RTC_INTR_FLAGS);
}
spin_unlock(&rtc_lock);

if (is_intr(irqstat)) {
Expand Down
9 changes: 9 additions & 0 deletions trunk/drivers/rtc/rtc-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
/* if the driver does not provide the ioctl interface
* or if that particular ioctl was not implemented
* (-ENOIOCTLCMD), we will try to emulate here.
*
* Drivers *SHOULD NOT* provide ioctl implementations
* for these requests. Instead, provide methods to
* support the following code, so that the RTC's main
* features are accessible without using ioctls.
*
* RTC and alarm times will be in UTC, by preference,
* but dual-booting with MS-Windows implies RTCs must
* use the local wall clock time.
*/

switch (cmd) {
Expand Down
19 changes: 13 additions & 6 deletions trunk/drivers/rtc/rtc-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@

/* device attributes */

/*
* NOTE: RTC times displayed in sysfs use the RTC's timezone. That's
* ideally UTC. However, PCs that also boot to MS-Windows normally use
* the local time and change to match daylight savings time. That affects
* attributes including date, time, since_epoch, and wakealarm.
*/

static ssize_t
rtc_sysfs_show_name(struct device *dev, struct device_attribute *attr,
char *buf)
Expand Down Expand Up @@ -113,13 +120,13 @@ rtc_sysfs_show_wakealarm(struct device *dev, struct device_attribute *attr,
unsigned long alarm;
struct rtc_wkalrm alm;

/* Don't show disabled alarms; but the RTC could leave the
* alarm enabled after it's already triggered. Alarms are
* conceptually one-shot, even though some common hardware
* (PCs) doesn't actually work that way.
/* Don't show disabled alarms. For uniformity, RTC alarms are
* conceptually one-shot, even though some common RTCs (on PCs)
* don't actually work that way.
*
* REVISIT maybe we should require RTC implementations to
* disable the RTC alarm after it triggers, for uniformity.
* NOTE: RTC implementations where the alarm doesn't match an
* exact YYYY-MM-DD HH:MM[:SS] date *must* disable their RTC
* alarms after they trigger, to ensure one-shot semantics.
*/
retval = rtc_read_alarm(to_rtc_device(dev), &alm);
if (retval == 0 && alm.enabled) {
Expand Down

0 comments on commit b38b5c2

Please sign in to comment.