summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJames Chapman <jchapman@katalix.com>2005-11-06 23:07:38 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2005-11-07 21:46:37 -0800
commitef9627464490fe67235bbd5724d55345b92c0315 (patch)
tree62ddcf3b6eaac8c723a09ab174c4afe330c135a3 /drivers/i2c
parenta852daa00ad91350fe603da47becaf3d5af4f2bd (diff)
downloadop-kernel-dev-ef9627464490fe67235bbd5724d55345b92c0315.zip
op-kernel-dev-ef9627464490fe67235bbd5724d55345b92c0315.tar.gz
[PATCH] i2c: ds1337 BCD conversion fix
Fix BCD value errors when month=9, moving the increment inside the BIN2BCD macro. Fix similar code for the weekday value, just for consistency. This bug was reported by Michael Burian <dynmail1@gassner-waagen.at>. Signed-off-by: James Chapman <jchapman@katalix.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/chips/ds1337.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
index 01b0370..02682fb 100644
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -164,9 +164,9 @@ static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt)
buf[1] = BIN2BCD(dt->tm_sec);
buf[2] = BIN2BCD(dt->tm_min);
buf[3] = BIN2BCD(dt->tm_hour);
- buf[4] = BIN2BCD(dt->tm_wday) + 1;
+ buf[4] = BIN2BCD(dt->tm_wday + 1);
buf[5] = BIN2BCD(dt->tm_mday);
- buf[6] = BIN2BCD(dt->tm_mon) + 1;
+ buf[6] = BIN2BCD(dt->tm_mon + 1);
val = dt->tm_year;
if (val >= 100) {
val -= 100;
OpenPOWER on IntegriCloud