rtc-pcf50606: Fix month off-by-one error
authorWerner Almesberger <werner@openmoko.org>
Wed, 1 Apr 2009 02:23:05 +0000 (23:23 -0300)
committerWerner Almesberger <werner@openmoko.org>
Wed, 1 Apr 2009 02:23:05 +0000 (23:23 -0300)
According to the PCF50606 manual, the issues resoved by commit
cc1663fc922c03feb0d7bbb8b18d62fbac0128de also exists there.

Signed-off-by: Werner Almesberger <werner@openmoko.org>
Reported-by: Rask Ingemann Lambertsen <rask@sygehus.dk>

drivers/rtc/rtc-pcf50606.c

index e059093..434cfc1 100644 (file)
@@ -70,7 +70,7 @@ static void pcf2rtc_time(struct rtc_time *rtc, struct pcf50606_time *pcf)
        rtc->tm_hour = bcd2bin(pcf->time[PCF50606_TI_HOUR]);
        rtc->tm_wday = bcd2bin(pcf->time[PCF50606_TI_WKDAY]);
        rtc->tm_mday = bcd2bin(pcf->time[PCF50606_TI_DAY]);
-       rtc->tm_mon = bcd2bin(pcf->time[PCF50606_TI_MONTH]);
+       rtc->tm_mon = bcd2bin(pcf->time[PCF50606_TI_MONTH]) - 1;
        rtc->tm_year = bcd2bin(pcf->time[PCF50606_TI_YEAR]) + 100;
 }
 
@@ -81,7 +81,7 @@ static void rtc2pcf_time(struct pcf50606_time *pcf, struct rtc_time *rtc)
        pcf->time[PCF50606_TI_HOUR] = bin2bcd(rtc->tm_hour);
        pcf->time[PCF50606_TI_WKDAY] = bin2bcd(rtc->tm_wday);
        pcf->time[PCF50606_TI_DAY] = bin2bcd(rtc->tm_mday);
-       pcf->time[PCF50606_TI_MONTH] = bin2bcd(rtc->tm_mon);
+       pcf->time[PCF50606_TI_MONTH] = bin2bcd(rtc->tm_mon + 1);
        pcf->time[PCF50606_TI_YEAR] = bin2bcd(rtc->tm_year % 100);
 }