platform/x86: dell-ddv: Use devm_battery_hook_register

Use devm_battery_hook_register() instead of manually calling
devm_add_action_or_reset() to simplify the code.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20250305053009.378609-3-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
Armin Wolf 2025-03-05 06:30:08 +01:00 committed by Ilpo Järvinen
parent 7a248294a3
commit 8dc3f0161e
No known key found for this signature in database
GPG Key ID: 59AC4F6153E5CE31

View File

@ -732,13 +732,6 @@ static int dell_wmi_ddv_remove_battery(struct power_supply *battery, struct acpi
return 0;
}
static void dell_wmi_ddv_battery_remove(void *data)
{
struct acpi_battery_hook *hook = data;
battery_hook_unregister(hook);
}
static int dell_wmi_ddv_battery_add(struct dell_wmi_ddv_data *data)
{
data->hook.name = "Dell DDV Battery Extension";
@ -755,9 +748,7 @@ static int dell_wmi_ddv_battery_add(struct dell_wmi_ddv_data *data)
data->eppid_attr.attr.mode = 0444;
data->eppid_attr.show = eppid_show;
battery_hook_register(&data->hook);
return devm_add_action_or_reset(&data->wdev->dev, dell_wmi_ddv_battery_remove, &data->hook);
return devm_battery_hook_register(&data->wdev->dev, &data->hook);
}
static int dell_wmi_ddv_buffer_read(struct seq_file *seq, enum dell_ddv_method method)