Commit bcd39ba7 authored by Hans de Goede's avatar Hans de Goede Committed by Sebastian Reichel

power: supply: axp288_charger: Some minor cleanups

Remove info->health, info->present and info->online caching, as no code
is reading the cached values.

Remove if (changed) check before calling power_supply_changed(), we
return early from axp288_charger_extcon_evt_worker if nothing has
changed, so the check is not needed.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
parent 71851a63
...@@ -167,14 +167,11 @@ struct axp288_chrg_info { ...@@ -167,14 +167,11 @@ struct axp288_chrg_info {
struct work_struct work; struct work_struct work;
} cable; } cable;
int health;
int inlmt; int inlmt;
int cc; int cc;
int cv; int cv;
int max_cc; int max_cc;
int max_cv; int max_cv;
bool online;
bool present;
bool is_charger_enabled; bool is_charger_enabled;
}; };
...@@ -432,8 +429,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy, ...@@ -432,8 +429,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy,
ret = axp288_charger_is_present(info); ret = axp288_charger_is_present(info);
if (ret < 0) if (ret < 0)
goto psy_get_prop_fail; goto psy_get_prop_fail;
info->present = ret; val->intval = ret;
val->intval = info->present;
break; break;
case POWER_SUPPLY_PROP_ONLINE: case POWER_SUPPLY_PROP_ONLINE:
/* Check for OTG case first */ /* Check for OTG case first */
...@@ -444,8 +440,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy, ...@@ -444,8 +440,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy,
ret = axp288_charger_is_online(info); ret = axp288_charger_is_online(info);
if (ret < 0) if (ret < 0)
goto psy_get_prop_fail; goto psy_get_prop_fail;
info->online = ret; val->intval = ret;
val->intval = info->online;
break; break;
case POWER_SUPPLY_PROP_HEALTH: case POWER_SUPPLY_PROP_HEALTH:
val->intval = axp288_get_charger_health(info); val->intval = axp288_get_charger_health(info);
...@@ -578,7 +573,6 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work) ...@@ -578,7 +573,6 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work)
struct axp288_chrg_info *info = struct axp288_chrg_info *info =
container_of(work, struct axp288_chrg_info, cable.work); container_of(work, struct axp288_chrg_info, cable.work);
int ret, current_limit; int ret, current_limit;
bool changed = false;
struct extcon_dev *edev = info->cable.edev; struct extcon_dev *edev = info->cable.edev;
bool old_connected = info->cable.connected; bool old_connected = info->cable.connected;
enum power_supply_type old_chg_type = info->cable.chg_type; enum power_supply_type old_chg_type = info->cable.chg_type;
...@@ -604,11 +598,8 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work) ...@@ -604,11 +598,8 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work)
} }
/* Cable status changed */ /* Cable status changed */
if (old_connected != info->cable.connected || if (old_connected == info->cable.connected &&
old_chg_type != info->cable.chg_type) old_chg_type == info->cable.chg_type)
changed = true;
if (!changed)
return; return;
mutex_lock(&info->lock); mutex_lock(&info->lock);
...@@ -643,13 +634,9 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work) ...@@ -643,13 +634,9 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work)
axp288_charger_enable_charger(info, false); axp288_charger_enable_charger(info, false);
} }
if (changed)
info->health = axp288_get_charger_health(info);
mutex_unlock(&info->lock); mutex_unlock(&info->lock);
if (changed) power_supply_changed(info->psy_usb);
power_supply_changed(info->psy_usb);
} }
static int axp288_charger_handle_cable_evt(struct notifier_block *nb, static int axp288_charger_handle_cable_evt(struct notifier_block *nb,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment