diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/Makefile | 8 | ||||
-rw-r--r-- | drivers/acpi/bus.c | 15 | ||||
-rw-r--r-- | drivers/acpi/debug.c | 14 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 7 | ||||
-rw-r--r-- | drivers/acpi/glue.c | 6 | ||||
-rw-r--r-- | drivers/acpi/internal.h | 43 | ||||
-rw-r--r-- | drivers/acpi/power.c | 8 | ||||
-rw-r--r-- | drivers/acpi/proc.c | 7 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 11 | ||||
-rw-r--r-- | drivers/acpi/sleep.c | 2 | ||||
-rw-r--r-- | drivers/acpi/system.c | 9 | ||||
-rw-r--r-- | drivers/acpi/wakeup.c | 9 |
12 files changed, 80 insertions, 59 deletions
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index b130ea0d0759..61675e21fba2 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -32,10 +32,8 @@ ifdef CONFIG_CPU_FREQ processor-objs += processor_perflib.o endif -obj-y += bus.o glue.o -obj-y += scan.o -# Keep EC driver first. Initialization of others depend on it. -obj-y += ec.o +obj-y += bus.o glue.o scan.o ec.o \ + power.o system.o event.o obj-$(CONFIG_ACPI_AC) += ac.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_BUTTON) += button.o @@ -51,8 +49,6 @@ obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o obj-$(CONFIG_ACPI_PROCESSOR) += processor.o obj-$(CONFIG_ACPI_CONTAINER) += container.o obj-$(CONFIG_ACPI_THERMAL) += thermal.o -obj-y += power.o -obj-y += system.o event.o obj-$(CONFIG_ACPI_DEBUG) += debug.o obj-$(CONFIG_ACPI_NUMA) += numa.o obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index bee64b73c919..e8f7b64e92da 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -39,6 +39,8 @@ #include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> +#include "internal.h" + #define _COMPONENT ACPI_BUS_COMPONENT ACPI_MODULE_NAME("bus"); @@ -846,6 +848,7 @@ static int __init acpi_init(void) acpi_kobj = NULL; } + init_acpi_device_notify(); result = acpi_bus_init(); if (!result) { @@ -860,11 +863,23 @@ static int __init acpi_init(void) } } else disable_acpi(); + + if (acpi_disabled) + return result; + /* * If the laptop falls into the DMI check table, the power state check * will be disabled in the course of device power transistion. */ dmi_check_system(power_nocheck_dmi_table); + + acpi_scan_init(); + acpi_ec_init(); + acpi_power_init(); + acpi_system_init(); + acpi_debug_init(); + acpi_sleep_proc_init(); + acpi_wakeup_device_init(); return result; } diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c index 20223cbd0d1c..9cb189f3c77c 100644 --- a/drivers/acpi/debug.c +++ b/drivers/acpi/debug.c @@ -297,17 +297,15 @@ acpi_system_write_debug(struct file *file, return count; } +#endif -static int __init acpi_debug_init(void) +int __init acpi_debug_init(void) { +#ifdef CONFIG_ACPI_PROCFS struct proc_dir_entry *entry; int error = 0; char *name; - - if (acpi_disabled) - return 0; - /* 'debug_layer' [R/W] */ name = ACPI_SYSTEM_FILE_DEBUG_LAYER; entry = @@ -338,7 +336,7 @@ static int __init acpi_debug_init(void) remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir); error = -ENODEV; goto Done; -} - -subsys_initcall(acpi_debug_init); +#else + return 0; #endif +} diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 2fe15060dcdc..bf88f1803801 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -1069,13 +1069,10 @@ static struct acpi_driver acpi_ec_driver = { }, }; -static int __init acpi_ec_init(void) +int __init acpi_ec_init(void) { int result = 0; - if (acpi_disabled) - return 0; - acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir); if (!acpi_ec_dir) return -ENODEV; @@ -1090,8 +1087,6 @@ static int __init acpi_ec_init(void) return result; } -subsys_initcall(acpi_ec_init); - /* EC driver currently not unloadable */ #if 0 static void __exit acpi_ec_exit(void) diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 5479b9f42513..8bd2c2a6884d 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -286,10 +286,8 @@ static int acpi_platform_notify_remove(struct device *dev) return 0; } -static int __init init_acpi_device_notify(void) +int __init init_acpi_device_notify(void) { - if (acpi_disabled) - return 0; if (platform_notify || platform_notify_remove) { printk(KERN_ERR PREFIX "Can't use platform_notify\n"); return 0; @@ -298,5 +296,3 @@ static int __init init_acpi_device_notify(void) platform_notify_remove = acpi_platform_notify_remove; return 0; } - -arch_initcall(init_acpi_device_notify); diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h new file mode 100644 index 000000000000..11a69b53004e --- /dev/null +++ b/drivers/acpi/internal.h @@ -0,0 +1,43 @@ +/* For use by Linux/ACPI infrastructure, not drivers */ + +int init_acpi_device_notify(void); +int acpi_scan_init(void); +int acpi_system_init(void); + +#ifdef CONFIG_ACPI_DEBUG +int acpi_debug_init(void); +#else +static inline int acpi_debug_init(void) { return 0; } +#endif + +/* -------------------------------------------------------------------------- + Power Resource + -------------------------------------------------------------------------- */ +int acpi_power_init(void); +int acpi_device_sleep_wake(struct acpi_device *dev, + int enable, int sleep_state, int dev_state); +int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state); +int acpi_disable_wakeup_device_power(struct acpi_device *dev); +int acpi_power_get_inferred_state(struct acpi_device *device); +int acpi_power_transition(struct acpi_device *device, int state); +extern int acpi_power_nocheck; + +int acpi_wakeup_device_init(void); + +/* -------------------------------------------------------------------------- + Embedded Controller + -------------------------------------------------------------------------- */ +int acpi_ec_init(void); +int acpi_ec_ecdt_probe(void); +int acpi_boot_ec_enable(void); + +/*-------------------------------------------------------------------------- + Suspend/Resume + -------------------------------------------------------------------------- */ +extern int acpi_sleep_init(void); + +#ifdef CONFIG_ACPI_SLEEP +int acpi_sleep_proc_init(void); +#else +static inline int acpi_sleep_proc_init(void) { return 0; } +#endif diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index c926e7d4a0d6..11968ba28feb 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -773,14 +773,10 @@ static int acpi_power_resume(struct acpi_device *device) return 0; } -static int __init acpi_power_init(void) +int __init acpi_power_init(void) { int result = 0; - - if (acpi_disabled) - return 0; - INIT_LIST_HEAD(&acpi_power_resource_list); acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir); @@ -795,5 +791,3 @@ static int __init acpi_power_init(void) return 0; } - -subsys_initcall(acpi_power_init); diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index 428c911dba08..05dfdc96802e 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c @@ -496,11 +496,8 @@ static u32 rtc_handler(void *context) } #endif /* HAVE_ACPI_LEGACY_ALARM */ -static int __init acpi_sleep_proc_init(void) +int __init acpi_sleep_proc_init(void) { - if (acpi_disabled) - return 0; - #ifdef CONFIG_ACPI_PROCFS /* 'sleep' [R/W] */ proc_create("sleep", S_IFREG | S_IRUGO | S_IWUSR, @@ -527,5 +524,3 @@ static int __init acpi_sleep_proc_init(void) return 0; } - -late_initcall(acpi_sleep_proc_init); diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index c54d7b6c4066..c548231965ef 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -11,6 +11,8 @@ #include <acpi/acpi_drivers.h> +#include "internal.h" + #define _COMPONENT ACPI_BUS_COMPONENT ACPI_MODULE_NAME("scan"); #define STRUCT_TO_INT(s) (*((int*)&s)) @@ -1524,16 +1526,11 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) return result; } - -static int __init acpi_scan_init(void) +int __init acpi_scan_init(void) { int result; struct acpi_bus_ops ops; - - if (acpi_disabled) - return 0; - memset(&ops, 0, sizeof(ops)); ops.acpi_op_add = 1; ops.acpi_op_start = 1; @@ -1566,5 +1563,3 @@ static int __init acpi_scan_init(void) Done: return result; } - -subsys_initcall(acpi_scan_init); diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 837ac7d5801b..91a284b54dbf 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -21,6 +21,8 @@ #include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> + +#include "internal.h" #include "sleep.h" u8 sleep_states[ACPI_S_STATE_COUNT]; diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 391d0358a592..3b88981dd215 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c @@ -571,12 +571,9 @@ static int acpi_system_procfs_init(void) } #endif -static int __init acpi_system_init(void) +int __init acpi_system_init(void) { - int result = 0; - - if (acpi_disabled) - return 0; + int result; result = acpi_system_procfs_init(); if (result) @@ -586,5 +583,3 @@ static int __init acpi_system_init(void) return result; } - -subsys_initcall(acpi_system_init); diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c index 2d34806d45dd..5aee8c26cc9f 100644 --- a/drivers/acpi/wakeup.c +++ b/drivers/acpi/wakeup.c @@ -8,6 +8,8 @@ #include <acpi/acpi_drivers.h> #include <linux/kernel.h> #include <linux/types.h> + +#include "internal.h" #include "sleep.h" #define _COMPONENT ACPI_SYSTEM_COMPONENT @@ -136,13 +138,10 @@ void acpi_disable_wakeup_device(u8 sleep_state) spin_unlock(&acpi_device_lock); } -static int __init acpi_wakeup_device_init(void) +int __init acpi_wakeup_device_init(void) { struct list_head *node, *next; - if (acpi_disabled) - return 0; - spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_wakeup_device_list) { struct acpi_device *dev = container_of(node, @@ -163,5 +162,3 @@ static int __init acpi_wakeup_device_init(void) spin_unlock(&acpi_device_lock); return 0; } - -late_initcall(acpi_wakeup_device_init); |