Skip to contentSkip to conversation

i2c chips: ds1337 2/2

PATCH In review James Chapman 2 participants 2 messages Nov 3, 2005 – Nov 5, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c chips: ds1337 2/2

Patch for ds1337 i2c driver:

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 <[email protected]>.

Signature · 4 lines
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development

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 <[email protected]>.

drivers/i2c/chips/ds1337.c +2 -2
Index: linux-2.6.14/drivers/i2c/chips/ds1337.c
===================================================================
@@ -177,9 +177,9 @@
 	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;
#1 lore raw

Hi James, Michael, all,

Quoted 5 lines

Patch for ds1337 i2c driver:

Fix BCD value errors when month=9, moving the increment inside the BIN2BCD macro.
Fix similar code for the weekday value, just for consistency.

Ouch, this was a nasty one. Patch applied, thanks. I'll make sure it makes it into mainline before 2.6.15.

Signature · 1 line
Jean Delvare