summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorMylène Josserand <mylene.josserand@free-electrons.com>2016-05-03 12:54:37 +0300
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2016-05-21 18:06:58 +0300
commit38201ca3c58d27ac95ee08995558c7176b4feb13 (patch)
tree644ba4a89f87dab515bde6123728808ee8e5804a /drivers/rtc
parentdc492e866a997b3df2a551fa772d6887a19e53b8 (diff)
downloadlinux-38201ca3c58d27ac95ee08995558c7176b4feb13.tar.xz
rtc: rv3029: fix set_time function
The bin2bcd function in set_time is uncorrect on weekdays as the bit mask should be done at the end of arithmetic operations. Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-rv3029c2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
index 88a0c188a6f2..916bbc2f57de 100644
--- a/drivers/rtc/rtc-rv3029c2.c
+++ b/drivers/rtc/rtc-rv3029c2.c
@@ -502,7 +502,7 @@ static int rv3029_set_time(struct device *dev, struct rtc_time *tm)
regs[RV3029_W_HOURS - RV3029_W_SEC] = bin2bcd(tm->tm_hour);
regs[RV3029_W_DATE - RV3029_W_SEC] = bin2bcd(tm->tm_mday);
regs[RV3029_W_MONTHS - RV3029_W_SEC] = bin2bcd(tm->tm_mon + 1);
- regs[RV3029_W_DAYS - RV3029_W_SEC] = bin2bcd((tm->tm_wday & 7) + 1);
+ regs[RV3029_W_DAYS - RV3029_W_SEC] = bin2bcd(tm->tm_wday + 1) & 0x7;
regs[RV3029_W_YEARS - RV3029_W_SEC] = bin2bcd(tm->tm_year - 100);
ret = rv3029_write_regs(dev, RV3029_W_SEC, regs,