summaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2021-10-18 15:50:53 +0200
committerSebastian Reichel <sebastian.reichel@collabora.com>2021-10-18 18:18:56 +0200
commit5b5100c569b533195d9535fd2155d9f1cf389d0c (patch)
tree3358cdbc1b32818f0bc6663e79b8e459d5506fda /drivers/power
parentpower: supply: axp288-charger: Remove unnecessary is_present and is_online he... (diff)
downloadlinux-5b5100c569b533195d9535fd2155d9f1cf389d0c.tar.xz
linux-5b5100c569b533195d9535fd2155d9f1cf389d0c.zip
power: supply: axp288-charger: Simplify axp288_get_charger_health()
Now that axp288_charger_usb_update_property() reads and caches all relevant registers, axp288_get_charger_health() can be simplified by directly returning the health. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/axp288_charger.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
index 6dfecf7c9250..ec41f6cd3f93 100644
--- a/drivers/power/supply/axp288_charger.c
+++ b/drivers/power/supply/axp288_charger.c
@@ -304,22 +304,17 @@ static int axp288_charger_enable_charger(struct axp288_chrg_info *info,
static int axp288_get_charger_health(struct axp288_chrg_info *info)
{
- int health = POWER_SUPPLY_HEALTH_UNKNOWN;
-
if (!(info->input_status & PS_STAT_VBUS_PRESENT))
- goto health_read_fail;
+ return POWER_SUPPLY_HEALTH_UNKNOWN;
if (!(info->input_status & PS_STAT_VBUS_VALID))
- health = POWER_SUPPLY_HEALTH_DEAD;
+ return POWER_SUPPLY_HEALTH_DEAD;
else if (info->op_mode & CHRG_STAT_PMIC_OTP)
- health = POWER_SUPPLY_HEALTH_OVERHEAT;
+ return POWER_SUPPLY_HEALTH_OVERHEAT;
else if (info->op_mode & CHRG_STAT_BAT_SAFE_MODE)
- health = POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE;
+ return POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE;
else
- health = POWER_SUPPLY_HEALTH_GOOD;
-
-health_read_fail:
- return health;
+ return POWER_SUPPLY_HEALTH_GOOD;
}
static int axp288_charger_usb_set_property(struct power_supply *psy,