]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ds2760_battery: Fix calculation of time_to_empty_now
authorSven Neumann <s.neumann@raumfeld.com>
Fri, 12 Nov 2010 10:36:22 +0000 (11:36 +0100)
committerAnton Vorontsov <cbouatmailru@gmail.com>
Thu, 18 Nov 2010 13:56:15 +0000 (16:56 +0300)
commit86af95039b69a90db15294eb1f9c147f1df0a8ea
treeda3a54667bdea3e0d8eb7dea9322c0970d59b27d
parente53beacd23d9cb47590da6a7a7f6d417b941a994
ds2760_battery: Fix calculation of time_to_empty_now

A check against division by zero was modified in commit b0525b48.
Since this change time_to_empty_now is always reported as zero
while the battery is discharging and as a negative value while
the battery is charging. This is because current is negative while
the battery is discharging.

Fix the check introduced by commit b0525b48 so that time_to_empty_now
is reported correctly during discharge and as zero while charging.

Signed-off-by: Sven Neumann <s.neumann@raumfeld.com>
Acked-by: Daniel Mack <daniel@caiaq.de>
Cc: stable@kernel.org [2.6.32..2.6.36]
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
drivers/power/ds2760_battery.c