Skip to contentSkip to conversation

power: supply: charger-manager: fix the wrong status of health

PATCH In review angkery 2 participants 2 messages Jan 16, 2021 Power supply

lore
Share & tools
lore

angkery

author
#0 lore raw

PATCH 1/1 power: supply: charger-manager: fix the wrong status of health

From: Junlin Yang <[email protected]>

cm->emergency_stop will only be the value in the enumeration, and can not be less than zero, it will get an exception value. So replace it with the corresponding value.

---
 drivers/power/supply/charger-manager.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/supply/charger-manager.c +2 -2
index 6fcebe4..0d28741 100644
@@ -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;
Signature · 1 line
1.9.1
#1 lore raw

Hi,

Quoted 8 lines · angkery

From: Junlin Yang <[email protected]>

cm->emergency_stop will only be the value in the enumeration, and can not be less than zero, it will get an exception value. So replace it with the corresponding value.

---

Thanks, queued.

-- Sebastian

Quoted 23 lines
 drivers/power/supply/charger-manager.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/supply/charger-manager.c +2 -2
index 6fcebe4..0d28741 100644
@@ -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;
Signature · 1 line
1.9.1