diff options
author | Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@teamlog.com> | 2006-09-30 23:28:12 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 00:39:25 -0700 |
commit | 1713e903c680de4934837689abecc5df02f463ac (patch) | |
tree | cc1677465cc57c2a0202eadd27a4a86baccf2850 | |
parent | 365e02237b164701897244aab7412b21c5e622af (diff) | |
download | linux-3.10-1713e903c680de4934837689abecc5df02f463ac.tar.gz linux-3.10-1713e903c680de4934837689abecc5df02f463ac.tar.bz2 linux-3.10-1713e903c680de4934837689abecc5df02f463ac.zip |
[PATCH] rtc driver rtc-pcf8563 century bit inversed
The century bit PCF8563_MO_C in the month register is misinterpreted. It
is set to 1 for the 20th century and 0 for 21th, and the driver is
expecting the opposite behavior.
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/rtc/rtc-pcf8563.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index ba9a583b7b6..bd431064303 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c @@ -95,7 +95,7 @@ static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm) tm->tm_wday = buf[PCF8563_REG_DW] & 0x07; tm->tm_mon = BCD2BIN(buf[PCF8563_REG_MO] & 0x1F) - 1; /* rtc mn 1-12 */ tm->tm_year = BCD2BIN(buf[PCF8563_REG_YR]) - + (buf[PCF8563_REG_MO] & PCF8563_MO_C ? 100 : 0); + + (buf[PCF8563_REG_MO] & PCF8563_MO_C ? 0 : 100); dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " "mday=%d, mon=%d, year=%d, wday=%d\n", @@ -135,7 +135,7 @@ static int pcf8563_set_datetime(struct i2c_client *client, struct rtc_time *tm) /* year and century */ buf[PCF8563_REG_YR] = BIN2BCD(tm->tm_year % 100); - if (tm->tm_year / 100) + if (tm->tm_year < 100) buf[PCF8563_REG_MO] |= PCF8563_MO_C; buf[PCF8563_REG_DW] = tm->tm_wday & 0x07; |