Skip to content

Commit 91b623c

Browse files
t-8chsre
authored andcommitted
power: supply: core: simplify charge_behaviour formatting
The function power_supply_show_charge_behaviour() is not needed and can be removed completely. Removing the function also saves a spurious read of the property from the driver on each call. The convulted logic was a leftover from an earlier patch revision. Some restructuring made this cleanup possible. Suggested-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/all/[email protected]/ Fixes: 4e61f1e ("power: supply: core: fix charge_behaviour formatting") Signed-off-by: Thomas Weißschuh <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 070c147 commit 91b623c

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

drivers/power/supply/power_supply_sysfs.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -271,23 +271,6 @@ static ssize_t power_supply_show_usb_type(struct device *dev,
271271
return count;
272272
}
273273

274-
static ssize_t power_supply_show_charge_behaviour(struct device *dev,
275-
struct power_supply *psy,
276-
union power_supply_propval *value,
277-
char *buf)
278-
{
279-
int ret;
280-
281-
ret = power_supply_get_property(psy,
282-
POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR,
283-
value);
284-
if (ret < 0)
285-
return ret;
286-
287-
return power_supply_charge_behaviour_show(dev, psy->desc->charge_behaviours,
288-
value->intval, buf);
289-
}
290-
291274
static ssize_t power_supply_show_property(struct device *dev,
292275
struct device_attribute *attr,
293276
char *buf) {
@@ -321,7 +304,8 @@ static ssize_t power_supply_show_property(struct device *dev,
321304
&value, buf);
322305
break;
323306
case POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR:
324-
ret = power_supply_show_charge_behaviour(dev, psy, &value, buf);
307+
ret = power_supply_charge_behaviour_show(dev, psy->desc->charge_behaviours,
308+
value.intval, buf);
325309
break;
326310
case POWER_SUPPLY_PROP_MODEL_NAME ... POWER_SUPPLY_PROP_SERIAL_NUMBER:
327311
ret = sysfs_emit(buf, "%s\n", value.strval);

0 commit comments

Comments
 (0)