summaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorJunlin Yang <yangjunlin@yulong.com>2021-01-16 19:41:20 +0800
committerSebastian Reichel <sre@kernel.org>2021-01-16 15:02:15 +0100
commit95b78d53706d3866c232e4f4819ad38a88f148d4 (patch)
tree8ebc07bd4d09c9e83a9f62bc8d5318296942def9 /drivers/power
parentb7e15bd0c17a37d6ab61dceb08ef683855e85635 (diff)
downloadlinux-95b78d53706d3866c232e4f4819ad38a88f148d4.tar.bz2
power: supply: charger-manager: fix incorrect health status
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>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/charger-manager.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c
index 6fcebe441552..0d28741b8ecb 100644
--- a/drivers/power/supply/charger-manager.c
+++ b/drivers/power/supply/charger-manager.c
@@ -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;