Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Hans de Goede and committed by
Sebastian Reichel
5b5100c5 9052ff9b

+5 -10
+5 -10
drivers/power/supply/axp288_charger.c
··· 304 304 305 305 static int axp288_get_charger_health(struct axp288_chrg_info *info) 306 306 { 307 - int health = POWER_SUPPLY_HEALTH_UNKNOWN; 308 - 309 307 if (!(info->input_status & PS_STAT_VBUS_PRESENT)) 310 - goto health_read_fail; 308 + return POWER_SUPPLY_HEALTH_UNKNOWN; 311 309 312 310 if (!(info->input_status & PS_STAT_VBUS_VALID)) 313 - health = POWER_SUPPLY_HEALTH_DEAD; 311 + return POWER_SUPPLY_HEALTH_DEAD; 314 312 else if (info->op_mode & CHRG_STAT_PMIC_OTP) 315 - health = POWER_SUPPLY_HEALTH_OVERHEAT; 313 + return POWER_SUPPLY_HEALTH_OVERHEAT; 316 314 else if (info->op_mode & CHRG_STAT_BAT_SAFE_MODE) 317 - health = POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE; 315 + return POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE; 318 316 else 319 - health = POWER_SUPPLY_HEALTH_GOOD; 320 - 321 - health_read_fail: 322 - return health; 317 + return POWER_SUPPLY_HEALTH_GOOD; 323 318 } 324 319 325 320 static int axp288_charger_usb_set_property(struct power_supply *psy,