]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
power: supply: axp288-charger: Remove unnecessary is_present and is_online helpers
authorHans de Goede <hdegoede@redhat.com>
Mon, 18 Oct 2021 13:50:52 +0000 (15:50 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Mon, 18 Oct 2021 16:18:56 +0000 (18:18 +0200)
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 <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/axp288_charger.c

index 9987b1731e38c0f78b82914b4804734588b72d88..6dfecf7c925005902cba1de5d119c0f95e0104e7 100644 (file)
@@ -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);