ACPI / battery: abort initialization earlier if acpi_disabled
authorLuis Henriques <luis.henriques@canonical.com>
Mon, 11 May 2015 21:48:38 +0000 (22:48 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 13 May 2015 22:58:39 +0000 (00:58 +0200)
If ACPI is disabled there's no need to schedule an async function call,
the driver initialization can be aborted earlier in acpi_battery_init().

Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/battery.c

index 63d43677f644bcc4c9d3aab0079167f35e7fdda8..69b8e607ec359a73a14b2fb83e6f63f7a1b5dfa2 100644 (file)
@@ -1292,9 +1292,6 @@ static struct acpi_driver acpi_battery_driver = {
 
 static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
 {
-       if (acpi_disabled)
-               return;
-
        dmi_check_system(bat_dmi_table);
        
 #ifdef CONFIG_ACPI_PROCFS_POWER
@@ -1313,6 +1310,9 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
 
 static int __init acpi_battery_init(void)
 {
+       if (acpi_disabled)
+               return -ENODEV;
+
        async_schedule(acpi_battery_init_async, NULL);
        return 0;
 }