summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-m48t59.c
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2008-09-08 03:25:20 +0200
committerDavid S. Miller <davem@davemloft.net>2008-09-08 03:25:20 +0200
commitd875a4b0ffad754e6d89fa561ea7dcdd79c9508b (patch)
tree7b1a6efc14843c5ea549daab1db0366f4f94f833 /drivers/rtc/rtc-m48t59.c
parentsparc64: fix wrong m48t59 RTC year (diff)
downloadlinux-d875a4b0ffad754e6d89fa561ea7dcdd79c9508b.tar.xz
linux-d875a4b0ffad754e6d89fa561ea7dcdd79c9508b.zip
rtc-m48t59: fix setting of a year on m48t08 and m48t02 rtcs
Fix setting of a year in m48t08 and m48t02 clocks. They do not have century bits and setting them causes the year to overflow (bit 0x80 set). Problem found by Robert Reif on Sun Sparcstation 20. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/rtc/rtc-m48t59.c')
-rw-r--r--drivers/rtc/rtc-m48t59.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index 867c8a79a6a8..761e9d7234fa 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -126,7 +126,7 @@ static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm)
M48T59_WRITE((BIN2BCD(tm->tm_mon + 1) & 0x1F), M48T59_MONTH);
M48T59_WRITE(BIN2BCD(tm->tm_year % 100), M48T59_YEAR);
- if (tm->tm_year/100)
+ if (pdata->type == M48T59RTC_TYPE_M48T59 && (tm->tm_year / 100))
val = (M48T59_WDAY_CEB | M48T59_WDAY_CB);
val |= (BIN2BCD(tm->tm_wday) & 0x07);
M48T59_WRITE(val, M48T59_WDAY);