Skip to contentSkip to conversation

ds2760_battery: Fix indexing of the 4 active full EEPROM registers

PATCH Applied Paul Parsons 2 participants 2 messages Apr 25, 2011 – May 20, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ds2760_battery: Fix indexing of the 4 active full EEPROM registers

Fix indexing of the 4 active full EEPROM registers. The indexing was out by 1, accessing the EEPROM registers at 0x23 to 0x26 instead of 0x22 to 0x25.

---

drivers/power/ds2760_battery.c +1 -1
@@ -186,7 +190,7 @@ static int ds2760_battery_read_status(st
 
 	scale[0] = di->full_active_uAh;
 	for (i = 1; i < 5; i++)
-		scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 2 + i];
+		scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 1 + i];
 
 	di->full_active_uAh = battery_interpolate(scale, di->temp_C / 10);
 	di->full_active_uAh *= 1000; /* convert to µAh */
#1 lore raw
Quoted 3 lines · Paul Parsons

Fix indexing of the 4 active full EEPROM registers. The indexing was out by 1, accessing the EEPROM registers at 0x23 to 0x26 instead of 0x22 to 0x25.

Applied, thank you!

Quoted 12 lines

---

drivers/power/ds2760_battery.c +1 -1
@@ -186,7 +190,7 @@ static int ds2760_battery_read_status(st
 
 	scale[0] = di->full_active_uAh;
 	for (i = 1; i < 5; i++)
-		scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 2 + i];
+		scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 1 + i];
 
 	di->full_active_uAh = battery_interpolate(scale, di->temp_C / 10);
 	di->full_active_uAh *= 1000; /* convert to µAh */
Signature · 2 lines
Anton Vorontsov
Email: [email protected]