summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2016-04-10 10:59:24 -0400
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2016-05-20 06:33:51 -0400
commitef50f86e15f2516658f0badd7890292d7a685106 (patch)
tree628d83f54ff9d7e178cfbc5aedbbcd954ad57e00
parentbc83a141b8351f6d4458dd13eca5a66f2c0f3323 (diff)
rtc: ds1302: fix write value for day of week register
The valid range of day of week register for DS1302 is 1 to 7. But the set_time callback for rtc-ds1302 attempts to write the value of tm->tm_wday which is in the range 0 to 6. While the get_time callback correctly decodes the register. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Sergey Yanovich <ynvich@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
-rw-r--r--drivers/rtc/rtc-ds1302.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-ds1302.c b/drivers/rtc/rtc-ds1302.c
index 283e653fa189..f5dd09fe5add 100644
--- a/drivers/rtc/rtc-ds1302.c
+++ b/drivers/rtc/rtc-ds1302.c
@@ -65,7 +65,7 @@ static int ds1302_rtc_set_time(struct device *dev, struct rtc_time *time)
65 *bp++ = bin2bcd(time->tm_hour); 65 *bp++ = bin2bcd(time->tm_hour);
66 *bp++ = bin2bcd(time->tm_mday); 66 *bp++ = bin2bcd(time->tm_mday);
67 *bp++ = bin2bcd(time->tm_mon + 1); 67 *bp++ = bin2bcd(time->tm_mon + 1);
68 *bp++ = time->tm_wday; 68 *bp++ = time->tm_wday + 1;
69 *bp++ = bin2bcd(time->tm_year % 100); 69 *bp++ = bin2bcd(time->tm_year % 100);
70 *bp++ = RTC_CMD_WRITE_DISABLE; 70 *bp++ = RTC_CMD_WRITE_DISABLE;
71 71