Skip to content

Commit

Permalink
rtc: ignore msb when reading back mday from alarm
Browse files Browse the repository at this point in the history
I have a system here that actively relies upon RTC wake alarms, and it
has been failing (again) for a few days when attempting to use the
/sys/class/rtc/rtc?/wakealarm interface.

The old (fixed by Linus) /proc/ interface still works, but I'd like to
get it using the new one.

This patch fixes rtc-cmos to ignore the two upper bits when reading the
BCD mday (day of month) register from CMOS.  Some systems (eg.  mine)
seem to have the top bit set to "1" for some reason.

The older /proc/ interface ignores the upper bits, and so we should too.

Signed-off-by: Mark Lord <mlord@pobox.com>
Acked-by: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Mark Lord authored and Linus Torvalds committed Nov 4, 2007
1 parent b4f5550 commit 615bb29
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/rtc/rtc-cmos.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ static int cmos_read_alarm(struct device *dev, struct rtc_wkalrm *t)
t->time.tm_hour = CMOS_READ(RTC_HOURS_ALARM);

if (cmos->day_alrm) {
t->time.tm_mday = CMOS_READ(cmos->day_alrm);
/* ignore upper bits on readback per ACPI spec */
t->time.tm_mday = CMOS_READ(cmos->day_alrm) & 0x3f;
if (!t->time.tm_mday)
t->time.tm_mday = -1;

Expand Down

0 comments on commit 615bb29

Please sign in to comment.