[PATCH] rtc-m48t59: fix setting of a year on m48t08 and m48t02 rtcs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Krzysztof Helt <krzysztof.h1@xxxxx>

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@xxxxx>

---

I am sorry. I was sure I had tested setting of time
and date on SS20 but I did not obviously.

diff -urp linux-old/drivers/rtc/rtc-m48t59.c linux-sparc/drivers/rtc/rtc-m48t59.c
--- linux-old/drivers/rtc/rtc-m48t59.c	2008-09-03 18:14:22.000000000 +0200
+++ linux-sparc/drivers/rtc/rtc-m48t59.c	2008-09-04 18:47:40.636685547 +0200
@@ -126,7 +126,7 @@ static int m48t59_rtc_set_time(struct de
 	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);


----------------------------------------------------------------------
Nie szukam kochanka!
>> http://link.interia.pl/f1eeb

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux