ACPI / battery: Safe unregistering of hooks
authorJouke Witteveen <j.witteveen@gmail.com>
Wed, 4 Jul 2018 10:27:15 +0000 (12:27 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 4 Jul 2018 10:36:29 +0000 (12:36 +0200)
commit673b4271665a12fa839a12abb50e6f6e9953c081
tree2ca1fcd964c3a1b8038840b4a009d5178ba36e9c
parent021c91791a5e7e85c567452f1be3e4c2c6cb6063
ACPI / battery: Safe unregistering of hooks

A hooking API was implemented for 4.17 in fa93854f7a7ed63d followed
by hooks for Thinkpad laptops in 2801b9683f740012. The Thinkpad
drivers did not support the Thinkpad 13 and the hooking API crashes
on unsupported batteries by altering a list of hooks during unsafe
iteration. Thus, Thinkpad 13 laptops could no longer boot.

Additionally, a lock was kept in place and debugging information was
printed out of order.

Fixes: fa93854f7a7e (battery: Add the battery hooking API)
Cc: 4.17+ <stable@vger.kernel.org> # 4.17+
Signed-off-by: Jouke Witteveen <j.witteveen@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/battery.c