summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2021-10-18 15:50:52 +0200
committerSebastian Reichel <sebastian.reichel@collabora.com>2021-10-18 18:18:56 +0200
commit9052ff9b0387a6931d40f6999186099d038d2d33 (patch)
tree746897b5b81c82495e1cd6d3d091348c14671edf
parent0b5a9135d5f12dce8dedaa18de6336364e04e873 (diff)
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 <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-rw-r--r--drivers/power/supply/axp288_charger.c22
1 files changed, 2 insertions, 20 deletions
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);