diff options
author | Zhao Yakui <yakui.zhao@intel.com> | 2008-04-15 17:34:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-15 22:35:40 -0400 |
commit | 2b653e06ce2d70d21483f22ef1b1b63749c54223 (patch) | |
tree | 4d0550c89b8a7ca419eedac240a21a3455abad79 /drivers/rtc/rtc-cmos.c | |
parent | bc65c724d5a2c61539b2c52680941505152fcf30 (diff) |
rtc: fix the error in the function of cmos_set_alarm
There is a bug in the function of cmos_set_alarm. RTC alarm time for October
can't be set correctly.
For October: 0x0A will be written into the RTC region (MONTH_ALARM) in current
kernel. But in fact 0x10 should be written. Wildcards are also not handled
correctly.
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
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-cmos.c')
-rw-r--r-- | drivers/rtc/rtc-cmos.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index b48517021ee6..dcdc142a3441 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -198,9 +198,8 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t) | |||
198 | 198 | ||
199 | /* Writing 0xff means "don't care" or "match all". */ | 199 | /* Writing 0xff means "don't care" or "match all". */ |
200 | 200 | ||
201 | mon = t->time.tm_mon; | 201 | mon = t->time.tm_mon + 1; |
202 | mon = (mon < 12) ? BIN2BCD(mon) : 0xff; | 202 | mon = (mon <= 12) ? BIN2BCD(mon) : 0xff; |
203 | mon++; | ||
204 | 203 | ||
205 | mday = t->time.tm_mday; | 204 | mday = t->time.tm_mday; |
206 | mday = (mday >= 1 && mday <= 31) ? BIN2BCD(mday) : 0xff; | 205 | mday = (mday >= 1 && mday <= 31) ? BIN2BCD(mday) : 0xff; |