mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 09:16:33 +00:00
ACPI: battery: initialize mutexes through devm_ APIs
Simplify the cleanup logic a bit. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://patch.msgid.link/20240904-acpi-battery-cleanups-v1-3-a3bf74f22d40@weissschuh.net Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
909dfc6069
commit
0710c1ce50
@ -1225,8 +1225,8 @@ static int acpi_battery_add(struct acpi_device *device)
|
||||
strscpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
|
||||
strscpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
|
||||
device->driver_data = battery;
|
||||
mutex_init(&battery->lock);
|
||||
mutex_init(&battery->sysfs_lock);
|
||||
devm_mutex_init(&device->dev, &battery->lock);
|
||||
devm_mutex_init(&device->dev, &battery->sysfs_lock);
|
||||
if (acpi_has_method(battery->device->handle, "_BIX"))
|
||||
set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags);
|
||||
|
||||
@ -1256,8 +1256,6 @@ static int acpi_battery_add(struct acpi_device *device)
|
||||
unregister_pm_notifier(&battery->pm_nb);
|
||||
fail:
|
||||
sysfs_remove_battery(battery);
|
||||
mutex_destroy(&battery->lock);
|
||||
mutex_destroy(&battery->sysfs_lock);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1277,9 +1275,6 @@ static void acpi_battery_remove(struct acpi_device *device)
|
||||
device_init_wakeup(&device->dev, 0);
|
||||
unregister_pm_notifier(&battery->pm_nb);
|
||||
sysfs_remove_battery(battery);
|
||||
|
||||
mutex_destroy(&battery->lock);
|
||||
mutex_destroy(&battery->sysfs_lock);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
Loading…
Reference in New Issue
Block a user