ACPI / battery: Correctly serialise with the pending async probe
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 19 May 2016 08:11:52 +0000 (09:11 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 20 May 2016 23:25:07 +0000 (01:25 +0200)
async_synchronize_cookie() only serialises all tasks up to the specified
cookie, and importantly does not wait for the task corresponding with
the cookie. [This is so that it can be trivially used from inside the
async_func_t in order to serialise with all preceding tasks.] In order
to serialise with acpi_battery_init_async() we need to compensate and
pass in the next cookie instead.

The impact today is zero since performing an async_schedule() from inside
a module init function will trigger an async_synchronize_full() prior to
the module loader's completion. However, if the probe was moved to its
own unregistered async_domain, then the async_synchronize_cookie would
be replaced with an async_synchronize_full_domain.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/battery.c

index b719ab3..ab23479 100644 (file)
@@ -1316,7 +1316,7 @@ static int __init acpi_battery_init(void)
 
 static void __exit acpi_battery_exit(void)
 {
-       async_synchronize_cookie(async_cookie);
+       async_synchronize_cookie(async_cookie + 1);
        acpi_bus_unregister_driver(&acpi_battery_driver);
 #ifdef CONFIG_ACPI_PROCFS_POWER
        acpi_unlock_battery_dir(acpi_battery_dir);