diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2009-01-10 14:19:05 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-04-04 12:51:17 -0400 |
commit | 0f66af530116e9f4dd97f328d91718b56a6fc5a4 (patch) | |
tree | cf52ad384538da69af1ec0c75f8296c9be469642 /drivers/acpi/battery.c | |
parent | 8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff) | |
download | linux-0f66af530116e9f4dd97f328d91718b56a6fc5a4.tar.gz linux-0f66af530116e9f4dd97f328d91718b56a6fc5a4.tar.bz2 linux-0f66af530116e9f4dd97f328d91718b56a6fc5a4.zip |
ACPI: battery: asynchronous init
The battery driver tends to take quite some time to initialize
(100ms-300ms is quite typical).
This patch initializes the batter driver asynchronously, so that other
things in the kernel can initialize in parallel to this 300 msec.
As part of this, the battery driver had to move to the back
of the ACPI init order (hence the Makefile change).
Without this move, the next ACPI driver would just block
on the ACPI/devicee layer semaphores until the battery driver was
done anyway, not gaining any boot time.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r-- | drivers/acpi/battery.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 69cbc57c2d1c..0f1c8190c1d3 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -30,6 +30,7 @@ #include <linux/init.h> #include <linux/types.h> #include <linux/jiffies.h> +#include <linux/async.h> #ifdef CONFIG_ACPI_PROCFS_POWER #include <linux/proc_fs.h> @@ -901,21 +902,27 @@ static struct acpi_driver acpi_battery_driver = { }, }; -static int __init acpi_battery_init(void) +static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) { if (acpi_disabled) - return -ENODEV; + return; #ifdef CONFIG_ACPI_PROCFS_POWER acpi_battery_dir = acpi_lock_battery_dir(); if (!acpi_battery_dir) - return -ENODEV; + return; #endif if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { #ifdef CONFIG_ACPI_PROCFS_POWER acpi_unlock_battery_dir(acpi_battery_dir); #endif - return -ENODEV; + return; } + return; +} + +static int __init acpi_battery_init(void) +{ + async_schedule(acpi_battery_init_async, NULL); return 0; } |