From: Mark Lord Date: Sun, 4 Nov 2007 02:04:03 +0000 (-0400) Subject: rtc: ignore msb when reading back mday from alarm X-Git-Tag: v2.6.24-rc2~42 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=615bb29ccbe9fa06d9f33b29d9c3f51340726656;p=linux-2.6 rtc: ignore msb when reading back mday from alarm 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 Acked-by: David Brownell Cc: Alessandro Zummo Signed-off-by: Linus Torvalds --- diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index e3fe83a23c..29cf1457ca 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -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;