Revert "ACPI: battery: Fix possible crash when unregistering a battery hook"
This reverts commit c9a7d95ef5
.
This commit is contained in:
parent
8e8df408d7
commit
a7dca58100
1 changed files with 3 additions and 9 deletions
|
@ -706,7 +706,7 @@ static void battery_hook_unregister_unlocked(struct acpi_battery_hook *hook)
|
|||
list_for_each_entry(battery, &acpi_battery_list, list) {
|
||||
hook->remove_battery(battery->bat);
|
||||
}
|
||||
list_del_init(&hook->list);
|
||||
list_del(&hook->list);
|
||||
|
||||
pr_info("extension unregistered: %s\n", hook->name);
|
||||
}
|
||||
|
@ -714,14 +714,7 @@ static void battery_hook_unregister_unlocked(struct acpi_battery_hook *hook)
|
|||
void battery_hook_unregister(struct acpi_battery_hook *hook)
|
||||
{
|
||||
mutex_lock(&hook_mutex);
|
||||
/*
|
||||
* Ignore already unregistered battery hooks. This might happen
|
||||
* if a battery hook was previously unloaded due to an error when
|
||||
* adding a new battery.
|
||||
*/
|
||||
if (!list_empty(&hook->list))
|
||||
battery_hook_unregister_unlocked(hook);
|
||||
|
||||
battery_hook_unregister_unlocked(hook);
|
||||
mutex_unlock(&hook_mutex);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(battery_hook_unregister);
|
||||
|
@ -731,6 +724,7 @@ void battery_hook_register(struct acpi_battery_hook *hook)
|
|||
struct acpi_battery *battery;
|
||||
|
||||
mutex_lock(&hook_mutex);
|
||||
INIT_LIST_HEAD(&hook->list);
|
||||
list_add(&hook->list, &battery_hook_list);
|
||||
/*
|
||||
* Now that the driver is registered, we need
|
||||
|
|
Loading…
Reference in a new issue