Skip to content

Commit

Permalink
[PATCH] i2c: ds1337 BCD conversion fix
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
James Chapman authored and Greg Kroah-Hartman committed Nov 8, 2005
1 parent a852daa commit ef96274
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/i2c/chips/ds1337.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ef96274

Please sign in to comment.