]> git.karo-electronics.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)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 21 Mar 2011 19:44:53 +0000 (12:44 -0700)
commit10b75926fef4637862aeb35bb0d2dd3e518ff2b9
tree102a716e520cb22c5131a34ec96f7b51f02acc16
parentec00083b5319728c4223e62dd603f4aac2985843
ds2760_battery: Fix calculation of time_to_empty_now

commit 86af95039b69a90db15294eb1f9c147f1df0a8ea upstream.

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>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/power/ds2760_battery.c