aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2009-01-10 14:19:05 -0500
committerLen Brown <len.brown@intel.com>2009-04-04 12:51:17 -0400
commit0f66af530116e9f4dd97f328d91718b56a6fc5a4 (patch)
treecf52ad384538da69af1ec0c75f8296c9be469642 /drivers/acpi
parent8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff)
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')
-rw-r--r--drivers/acpi/Makefile2
-rw-r--r--drivers/acpi/battery.c15
2 files changed, 12 insertions, 5 deletions
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index b130ea0d0759..298caf6862b6 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -37,7 +37,6 @@ obj-y += scan.o
37# Keep EC driver first. Initialization of others depend on it. 37# Keep EC driver first. Initialization of others depend on it.
38obj-y += ec.o 38obj-y += ec.o
39obj-$(CONFIG_ACPI_AC) += ac.o 39obj-$(CONFIG_ACPI_AC) += ac.o
40obj-$(CONFIG_ACPI_BATTERY) += battery.o
41obj-$(CONFIG_ACPI_BUTTON) += button.o 40obj-$(CONFIG_ACPI_BUTTON) += button.o
42obj-$(CONFIG_ACPI_FAN) += fan.o 41obj-$(CONFIG_ACPI_FAN) += fan.o
43obj-$(CONFIG_ACPI_DOCK) += dock.o 42obj-$(CONFIG_ACPI_DOCK) += dock.o
@@ -57,5 +56,6 @@ obj-$(CONFIG_ACPI_DEBUG) += debug.o
57obj-$(CONFIG_ACPI_NUMA) += numa.o 56obj-$(CONFIG_ACPI_NUMA) += numa.o
58obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o 57obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
59obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o 58obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
59obj-$(CONFIG_ACPI_BATTERY) += battery.o
60obj-$(CONFIG_ACPI_SBS) += sbshc.o 60obj-$(CONFIG_ACPI_SBS) += sbshc.o
61obj-$(CONFIG_ACPI_SBS) += sbs.o 61obj-$(CONFIG_ACPI_SBS) += sbs.o
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 @@
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/jiffies.h> 32#include <linux/jiffies.h>
33#include <linux/async.h>
33 34
34#ifdef CONFIG_ACPI_PROCFS_POWER 35#ifdef CONFIG_ACPI_PROCFS_POWER
35#include <linux/proc_fs.h> 36#include <linux/proc_fs.h>
@@ -901,21 +902,27 @@ static struct acpi_driver acpi_battery_driver = {
901 }, 902 },
902}; 903};
903 904
904static int __init acpi_battery_init(void) 905static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
905{ 906{
906 if (acpi_disabled) 907 if (acpi_disabled)
907 return -ENODEV; 908 return;
908#ifdef CONFIG_ACPI_PROCFS_POWER 909#ifdef CONFIG_ACPI_PROCFS_POWER
909 acpi_battery_dir = acpi_lock_battery_dir(); 910 acpi_battery_dir = acpi_lock_battery_dir();
910 if (!acpi_battery_dir) 911 if (!acpi_battery_dir)
911 return -ENODEV; 912 return;
912#endif 913#endif
913 if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { 914 if (acpi_bus_register_driver(&acpi_battery_driver) < 0) {
914#ifdef CONFIG_ACPI_PROCFS_POWER 915#ifdef CONFIG_ACPI_PROCFS_POWER
915 acpi_unlock_battery_dir(acpi_battery_dir); 916 acpi_unlock_battery_dir(acpi_battery_dir);
916#endif 917#endif
917 return -ENODEV; 918 return;
918 } 919 }
920 return;
921}
922
923static int __init acpi_battery_init(void)
924{
925 async_schedule(acpi_battery_init_async, NULL);
919 return 0; 926 return 0;
920} 927}
921 928