From 9052ff9b0387a6931d40f6999186099d038d2d33 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 18 Oct 2021 15:50:52 +0200 Subject: power: supply: axp288-charger: Remove unnecessary is_present and is_online helpers Now that axp288_charger_usb_update_property() reads and caches all relevant registers, the axp288_charger_is_present() and axp288_charger_is_online() helpers are not necessary anymore. Directly check the cached input_status instead, allowing the removal of these 2 helpers. Signed-off-by: Hans de Goede Signed-off-by: Sebastian Reichel --- drivers/power/supply/axp288_charger.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'drivers/power') diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c index 9987b1731e38..6dfecf7c9250 100644 --- a/drivers/power/supply/axp288_charger.c +++ b/drivers/power/supply/axp288_charger.c @@ -302,24 +302,6 @@ static int axp288_charger_enable_charger(struct axp288_chrg_info *info, return ret; } -static int axp288_charger_is_present(struct axp288_chrg_info *info) -{ - int present = 0; - - if (info->input_status & PS_STAT_VBUS_PRESENT) - present = 1; - return present; -} - -static int axp288_charger_is_online(struct axp288_chrg_info *info) -{ - int online = 0; - - if (info->input_status & PS_STAT_VBUS_VALID) - online = 1; - return online; -} - static int axp288_get_charger_health(struct axp288_chrg_info *info) { int health = POWER_SUPPLY_HEALTH_UNKNOWN; @@ -450,7 +432,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy, val->intval = 0; break; } - val->intval = axp288_charger_is_present(info); + val->intval = (info->input_status & PS_STAT_VBUS_PRESENT) ? 1 : 0; break; case POWER_SUPPLY_PROP_ONLINE: /* Check for OTG case first */ @@ -458,7 +440,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy, val->intval = 0; break; } - val->intval = axp288_charger_is_online(info); + val->intval = (info->input_status & PS_STAT_VBUS_VALID) ? 1 : 0; break; case POWER_SUPPLY_PROP_HEALTH: val->intval = axp288_get_charger_health(info); -- cgit v1.2.3