diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2022-02-05 17:40:57 +0100 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2022-02-11 19:45:52 +0100 |
commit | a942f913a902e13218e3bdba3088b58124f63a44 (patch) | |
tree | 65b52d9cd18ba958486883f395d2b5fd77c71820 /drivers/power/supply/power_supply_hwmon.c | |
parent | f059b46e6fc3eb07e54e2a94912740da49f1d652 (diff) | |
download | linux-a942f913a902e13218e3bdba3088b58124f63a44.tar.bz2 |
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>
Diffstat (limited to 'drivers/power/supply/power_supply_hwmon.c')
-rw-r--r-- | drivers/power/supply/power_supply_hwmon.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/power/supply/power_supply_hwmon.c b/drivers/power/supply/power_supply_hwmon.c index bffe6d84c429..a48aa4afb828 100644 --- a/drivers/power/supply/power_supply_hwmon.c +++ b/drivers/power/supply/power_supply_hwmon.c @@ -324,11 +324,6 @@ static const struct hwmon_chip_info power_supply_hwmon_chip_info = { .info = power_supply_hwmon_info, }; -static void power_supply_hwmon_bitmap_free(void *data) -{ - bitmap_free(data); -} - int power_supply_add_hwmon_sysfs(struct power_supply *psy) { const struct power_supply_desc *desc = psy->desc; @@ -349,18 +344,14 @@ int power_supply_add_hwmon_sysfs(struct power_supply *psy) } psyhw->psy = psy; - psyhw->props = bitmap_zalloc(POWER_SUPPLY_PROP_TIME_TO_FULL_AVG + 1, - GFP_KERNEL); + psyhw->props = devm_bitmap_zalloc(dev, + POWER_SUPPLY_PROP_TIME_TO_FULL_AVG + 1, + GFP_KERNEL); if (!psyhw->props) { ret = -ENOMEM; goto error; } - ret = devm_add_action_or_reset(dev, power_supply_hwmon_bitmap_free, - psyhw->props); - if (ret) - goto error; - for (i = 0; i < desc->num_properties; i++) { const enum power_supply_property prop = desc->properties[i]; |