aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/rtc/rtc-pcf8563.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index ba9a583b7b68..bd4310643038 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)
95 tm->tm_wday = buf[PCF8563_REG_DW] & 0x07; 95 tm->tm_wday = buf[PCF8563_REG_DW] & 0x07;
96 tm->tm_mon = BCD2BIN(buf[PCF8563_REG_MO] & 0x1F) - 1; /* rtc mn 1-12 */ 96 tm->tm_mon = BCD2BIN(buf[PCF8563_REG_MO] & 0x1F) - 1; /* rtc mn 1-12 */
97 tm->tm_year = BCD2BIN(buf[PCF8563_REG_YR]) 97 tm->tm_year = BCD2BIN(buf[PCF8563_REG_YR])
98 + (buf[PCF8563_REG_MO] & PCF8563_MO_C ? 100 : 0); 98 + (buf[PCF8563_REG_MO] & PCF8563_MO_C ? 0 : 100);
99 99
100 dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " 100 dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, "
101 "mday=%d, mon=%d, year=%d, wday=%d\n", 101 "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)
135 135
136 /* year and century */ 136 /* year and century */
137 buf[PCF8563_REG_YR] = BIN2BCD(tm->tm_year % 100); 137 buf[PCF8563_REG_YR] = BIN2BCD(tm->tm_year % 100);
138 if (tm->tm_year / 100) 138 if (tm->tm_year < 100)
139 buf[PCF8563_REG_MO] |= PCF8563_MO_C; 139 buf[PCF8563_REG_MO] |= PCF8563_MO_C;
140 140
141 buf[PCF8563_REG_DW] = tm->tm_wday & 0x07; 141 buf[PCF8563_REG_DW] = tm->tm_wday & 0x07;