]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
power: supply: charger-manager: fix incorrect health status
authorJunlin Yang <yangjunlin@yulong.com>
Sat, 16 Jan 2021 11:41:20 +0000 (19:41 +0800)
committerSebastian Reichel <sre@kernel.org>
Sat, 16 Jan 2021 14:02:15 +0000 (15:02 +0100)
cm->emergency_stop will only be the value in the enumeration,
and cannot be less than zero, it will get an exception value.
So replace it with the corresponding value.

Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/charger-manager.c

index 6fcebe4415522c1e019c0840d018025379af98f2..0d28741b8ecb3b12758739bd5d9cae278aa4ce0b 100644 (file)
@@ -723,9 +723,9 @@ static int charger_get_property(struct power_supply *psy,
                val->intval = cm->battery_status;
                break;
        case POWER_SUPPLY_PROP_HEALTH:
-               if (cm->emergency_stop > 0)
+               if (cm->emergency_stop == CM_BATT_OVERHEAT)
                        val->intval = POWER_SUPPLY_HEALTH_OVERHEAT;
-               else if (cm->emergency_stop < 0)
+               else if (cm->emergency_stop == CM_BATT_COLD)
                        val->intval = POWER_SUPPLY_HEALTH_COLD;
                else
                        val->intval = POWER_SUPPLY_HEALTH_GOOD;