mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
jz4740-battery: Correct voltage change check
The check is supposed to avoid redundant update notifications, so it should check for the difference between old and new voltage exceeding a threshold. Also make sure the result of a failed read is never stored. Signed-off-by: Maarten ter Huurne <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
This commit is contained in:
parent
9052768fe4
commit
754645342a
1 changed files with 1 additions and 1 deletions
|
|
@ -208,7 +208,7 @@ static void jz_battery_update(struct jz_battery *jz_battery)
|
|||
}
|
||||
|
||||
voltage = jz_battery_read_voltage(jz_battery);
|
||||
if (abs(voltage - jz_battery->voltage) < 50000) {
|
||||
if (voltage >= 0 && abs(voltage - jz_battery->voltage) > 50000) {
|
||||
jz_battery->voltage = voltage;
|
||||
has_changed = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue