Skip to content

Commit 851c030

Browse files
author
Al Stone
committed
power: supply: core: Simplify hwmon memory allocation
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2071846 Tested: This is one of a series of patch sets to enable Arm SystemReady IR support in the kernel for NXP i.MX8 platforms. This set updates the power subsystem. This set has been tested via simple boot tests and the CI loop. commit a942f91 Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Date: Sat Feb 5 17:40:57 2022 +0100 power: supply: core: Simplify hwmon memory allocation Use devm_bitmap_zalloc() instead of hand writing it. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> (cherry picked from commit a942f91) Signed-off-by: Al Stone <ahs3@redhat.com>
1 parent 6e5f094 commit 851c030

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

drivers/power/supply/power_supply_hwmon.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,6 @@ static const struct hwmon_chip_info power_supply_hwmon_chip_info = {
324324
.info = power_supply_hwmon_info,
325325
};
326326

327-
static void power_supply_hwmon_bitmap_free(void *data)
328-
{
329-
bitmap_free(data);
330-
}
331-
332327
int power_supply_add_hwmon_sysfs(struct power_supply *psy)
333328
{
334329
const struct power_supply_desc *desc = psy->desc;
@@ -349,18 +344,14 @@ int power_supply_add_hwmon_sysfs(struct power_supply *psy)
349344
}
350345

351346
psyhw->psy = psy;
352-
psyhw->props = bitmap_zalloc(POWER_SUPPLY_PROP_TIME_TO_FULL_AVG + 1,
353-
GFP_KERNEL);
347+
psyhw->props = devm_bitmap_zalloc(dev,
348+
POWER_SUPPLY_PROP_TIME_TO_FULL_AVG + 1,
349+
GFP_KERNEL);
354350
if (!psyhw->props) {
355351
ret = -ENOMEM;
356352
goto error;
357353
}
358354

359-
ret = devm_add_action_or_reset(dev, power_supply_hwmon_bitmap_free,
360-
psyhw->props);
361-
if (ret)
362-
goto error;
363-
364355
for (i = 0; i < desc->num_properties; i++) {
365356
const enum power_supply_property prop = desc->properties[i];
366357

0 commit comments

Comments
 (0)