diff options
author | Len Brown <len.brown@intel.com> | 2009-04-05 01:38:31 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-04-05 01:38:31 -0400 |
commit | 9a38f4eec57cc5104b6a85bc6d0a91b268fbe803 (patch) | |
tree | da01b5dd92d4076878003a8886fc2c9265e578f5 /drivers/acpi | |
parent | 67dc092187626ac55a60877485f78bc291cbfa81 (diff) | |
parent | 018f452e9d9d0cb5c3e8d33fd94dc6cd3c520a8f (diff) |
Merge branch 'bjorn-initcall-cleanup' into release
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 | |||
32 | processor-objs += processor_perflib.o | 32 | processor-objs += processor_perflib.o |
33 | endif | 33 | endif |
34 | 34 | ||
35 | obj-y += bus.o glue.o | 35 | obj-y += bus.o glue.o scan.o ec.o \ |
36 | obj-y += scan.o | 36 | power.o system.o event.o |
37 | # Keep EC driver first. Initialization of others depend on it. | ||
38 | obj-y += ec.o | ||
39 | obj-$(CONFIG_ACPI_AC) += ac.o | 37 | obj-$(CONFIG_ACPI_AC) += ac.o |
40 | obj-$(CONFIG_ACPI_BATTERY) += battery.o | 38 | obj-$(CONFIG_ACPI_BATTERY) += battery.o |
41 | obj-$(CONFIG_ACPI_BUTTON) += button.o | 39 | obj-$(CONFIG_ACPI_BUTTON) += button.o |
@@ -51,8 +49,6 @@ obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o | |||
51 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o | 49 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o |
52 | obj-$(CONFIG_ACPI_CONTAINER) += container.o | 50 | obj-$(CONFIG_ACPI_CONTAINER) += container.o |
53 | obj-$(CONFIG_ACPI_THERMAL) += thermal.o | 51 | obj-$(CONFIG_ACPI_THERMAL) += thermal.o |
54 | obj-y += power.o | ||
55 | obj-y += system.o event.o | ||
56 | obj-$(CONFIG_ACPI_DEBUG) += debug.o | 52 | obj-$(CONFIG_ACPI_DEBUG) += debug.o |
57 | obj-$(CONFIG_ACPI_NUMA) += numa.o | 53 | obj-$(CONFIG_ACPI_NUMA) += numa.o |
58 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o | 54 | 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 @@ | |||
39 | #include <acpi/acpi_bus.h> | 39 | #include <acpi/acpi_bus.h> |
40 | #include <acpi/acpi_drivers.h> | 40 | #include <acpi/acpi_drivers.h> |
41 | 41 | ||
42 | #include "internal.h" | ||
43 | |||
42 | #define _COMPONENT ACPI_BUS_COMPONENT | 44 | #define _COMPONENT ACPI_BUS_COMPONENT |
43 | ACPI_MODULE_NAME("bus"); | 45 | ACPI_MODULE_NAME("bus"); |
44 | 46 | ||
@@ -846,6 +848,7 @@ static int __init acpi_init(void) | |||
846 | acpi_kobj = NULL; | 848 | acpi_kobj = NULL; |
847 | } | 849 | } |
848 | 850 | ||
851 | init_acpi_device_notify(); | ||
849 | result = acpi_bus_init(); | 852 | result = acpi_bus_init(); |
850 | 853 | ||
851 | if (!result) { | 854 | if (!result) { |
@@ -860,11 +863,23 @@ static int __init acpi_init(void) | |||
860 | } | 863 | } |
861 | } else | 864 | } else |
862 | disable_acpi(); | 865 | disable_acpi(); |
866 | |||
867 | if (acpi_disabled) | ||
868 | return result; | ||
869 | |||
863 | /* | 870 | /* |
864 | * If the laptop falls into the DMI check table, the power state check | 871 | * If the laptop falls into the DMI check table, the power state check |
865 | * will be disabled in the course of device power transistion. | 872 | * will be disabled in the course of device power transistion. |
866 | */ | 873 | */ |
867 | dmi_check_system(power_nocheck_dmi_table); | 874 | dmi_check_system(power_nocheck_dmi_table); |
875 | |||
876 | acpi_scan_init(); | ||
877 | acpi_ec_init(); | ||
878 | acpi_power_init(); | ||
879 | acpi_system_init(); | ||
880 | acpi_debug_init(); | ||
881 | acpi_sleep_proc_init(); | ||
882 | acpi_wakeup_device_init(); | ||
868 | return result; | 883 | return result; |
869 | } | 884 | } |
870 | 885 | ||
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, | |||
297 | 297 | ||
298 | return count; | 298 | return count; |
299 | } | 299 | } |
300 | #endif | ||
300 | 301 | ||
301 | static int __init acpi_debug_init(void) | 302 | int __init acpi_debug_init(void) |
302 | { | 303 | { |
304 | #ifdef CONFIG_ACPI_PROCFS | ||
303 | struct proc_dir_entry *entry; | 305 | struct proc_dir_entry *entry; |
304 | int error = 0; | 306 | int error = 0; |
305 | char *name; | 307 | char *name; |
306 | 308 | ||
307 | |||
308 | if (acpi_disabled) | ||
309 | return 0; | ||
310 | |||
311 | /* 'debug_layer' [R/W] */ | 309 | /* 'debug_layer' [R/W] */ |
312 | name = ACPI_SYSTEM_FILE_DEBUG_LAYER; | 310 | name = ACPI_SYSTEM_FILE_DEBUG_LAYER; |
313 | entry = | 311 | entry = |
@@ -338,7 +336,7 @@ static int __init acpi_debug_init(void) | |||
338 | remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir); | 336 | remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir); |
339 | error = -ENODEV; | 337 | error = -ENODEV; |
340 | goto Done; | 338 | goto Done; |
341 | } | 339 | #else |
342 | 340 | return 0; | |
343 | subsys_initcall(acpi_debug_init); | ||
344 | #endif | 341 | #endif |
342 | } | ||
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 = { | |||
1069 | }, | 1069 | }, |
1070 | }; | 1070 | }; |
1071 | 1071 | ||
1072 | static int __init acpi_ec_init(void) | 1072 | int __init acpi_ec_init(void) |
1073 | { | 1073 | { |
1074 | int result = 0; | 1074 | int result = 0; |
1075 | 1075 | ||
1076 | if (acpi_disabled) | ||
1077 | return 0; | ||
1078 | |||
1079 | acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir); | 1076 | acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir); |
1080 | if (!acpi_ec_dir) | 1077 | if (!acpi_ec_dir) |
1081 | return -ENODEV; | 1078 | return -ENODEV; |
@@ -1090,8 +1087,6 @@ static int __init acpi_ec_init(void) | |||
1090 | return result; | 1087 | return result; |
1091 | } | 1088 | } |
1092 | 1089 | ||
1093 | subsys_initcall(acpi_ec_init); | ||
1094 | |||
1095 | /* EC driver currently not unloadable */ | 1090 | /* EC driver currently not unloadable */ |
1096 | #if 0 | 1091 | #if 0 |
1097 | static void __exit acpi_ec_exit(void) | 1092 | 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) | |||
286 | return 0; | 286 | return 0; |
287 | } | 287 | } |
288 | 288 | ||
289 | static int __init init_acpi_device_notify(void) | 289 | int __init init_acpi_device_notify(void) |
290 | { | 290 | { |
291 | if (acpi_disabled) | ||
292 | return 0; | ||
293 | if (platform_notify || platform_notify_remove) { | 291 | if (platform_notify || platform_notify_remove) { |
294 | printk(KERN_ERR PREFIX "Can't use platform_notify\n"); | 292 | printk(KERN_ERR PREFIX "Can't use platform_notify\n"); |
295 | return 0; | 293 | return 0; |
@@ -298,5 +296,3 @@ static int __init init_acpi_device_notify(void) | |||
298 | platform_notify_remove = acpi_platform_notify_remove; | 296 | platform_notify_remove = acpi_platform_notify_remove; |
299 | return 0; | 297 | return 0; |
300 | } | 298 | } |
301 | |||
302 | 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 @@ | |||
1 | /* For use by Linux/ACPI infrastructure, not drivers */ | ||
2 | |||
3 | int init_acpi_device_notify(void); | ||
4 | int acpi_scan_init(void); | ||
5 | int acpi_system_init(void); | ||
6 | |||
7 | #ifdef CONFIG_ACPI_DEBUG | ||
8 | int acpi_debug_init(void); | ||
9 | #else | ||
10 | static inline int acpi_debug_init(void) { return 0; } | ||
11 | #endif | ||
12 | |||
13 | /* -------------------------------------------------------------------------- | ||
14 | Power Resource | ||
15 | -------------------------------------------------------------------------- */ | ||
16 | int acpi_power_init(void); | ||
17 | int acpi_device_sleep_wake(struct acpi_device *dev, | ||
18 | int enable, int sleep_state, int dev_state); | ||
19 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state); | ||
20 | int acpi_disable_wakeup_device_power(struct acpi_device *dev); | ||
21 | int acpi_power_get_inferred_state(struct acpi_device *device); | ||
22 | int acpi_power_transition(struct acpi_device *device, int state); | ||
23 | extern int acpi_power_nocheck; | ||
24 | |||
25 | int acpi_wakeup_device_init(void); | ||
26 | |||
27 | /* -------------------------------------------------------------------------- | ||
28 | Embedded Controller | ||
29 | -------------------------------------------------------------------------- */ | ||
30 | int acpi_ec_init(void); | ||
31 | int acpi_ec_ecdt_probe(void); | ||
32 | int acpi_boot_ec_enable(void); | ||
33 | |||
34 | /*-------------------------------------------------------------------------- | ||
35 | Suspend/Resume | ||
36 | -------------------------------------------------------------------------- */ | ||
37 | extern int acpi_sleep_init(void); | ||
38 | |||
39 | #ifdef CONFIG_ACPI_SLEEP | ||
40 | int acpi_sleep_proc_init(void); | ||
41 | #else | ||
42 | static inline int acpi_sleep_proc_init(void) { return 0; } | ||
43 | #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) | |||
773 | return 0; | 773 | return 0; |
774 | } | 774 | } |
775 | 775 | ||
776 | static int __init acpi_power_init(void) | 776 | int __init acpi_power_init(void) |
777 | { | 777 | { |
778 | int result = 0; | 778 | int result = 0; |
779 | 779 | ||
780 | |||
781 | if (acpi_disabled) | ||
782 | return 0; | ||
783 | |||
784 | INIT_LIST_HEAD(&acpi_power_resource_list); | 780 | INIT_LIST_HEAD(&acpi_power_resource_list); |
785 | 781 | ||
786 | acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir); | 782 | acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir); |
@@ -795,5 +791,3 @@ static int __init acpi_power_init(void) | |||
795 | 791 | ||
796 | return 0; | 792 | return 0; |
797 | } | 793 | } |
798 | |||
799 | 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) | |||
496 | } | 496 | } |
497 | #endif /* HAVE_ACPI_LEGACY_ALARM */ | 497 | #endif /* HAVE_ACPI_LEGACY_ALARM */ |
498 | 498 | ||
499 | static int __init acpi_sleep_proc_init(void) | 499 | int __init acpi_sleep_proc_init(void) |
500 | { | 500 | { |
501 | if (acpi_disabled) | ||
502 | return 0; | ||
503 | |||
504 | #ifdef CONFIG_ACPI_PROCFS | 501 | #ifdef CONFIG_ACPI_PROCFS |
505 | /* 'sleep' [R/W] */ | 502 | /* 'sleep' [R/W] */ |
506 | proc_create("sleep", S_IFREG | S_IRUGO | S_IWUSR, | 503 | proc_create("sleep", S_IFREG | S_IRUGO | S_IWUSR, |
@@ -527,5 +524,3 @@ static int __init acpi_sleep_proc_init(void) | |||
527 | 524 | ||
528 | return 0; | 525 | return 0; |
529 | } | 526 | } |
530 | |||
531 | 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 @@ | |||
11 | 11 | ||
12 | #include <acpi/acpi_drivers.h> | 12 | #include <acpi/acpi_drivers.h> |
13 | 13 | ||
14 | #include "internal.h" | ||
15 | |||
14 | #define _COMPONENT ACPI_BUS_COMPONENT | 16 | #define _COMPONENT ACPI_BUS_COMPONENT |
15 | ACPI_MODULE_NAME("scan"); | 17 | ACPI_MODULE_NAME("scan"); |
16 | #define STRUCT_TO_INT(s) (*((int*)&s)) | 18 | #define STRUCT_TO_INT(s) (*((int*)&s)) |
@@ -1524,16 +1526,11 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) | |||
1524 | return result; | 1526 | return result; |
1525 | } | 1527 | } |
1526 | 1528 | ||
1527 | 1529 | int __init acpi_scan_init(void) | |
1528 | static int __init acpi_scan_init(void) | ||
1529 | { | 1530 | { |
1530 | int result; | 1531 | int result; |
1531 | struct acpi_bus_ops ops; | 1532 | struct acpi_bus_ops ops; |
1532 | 1533 | ||
1533 | |||
1534 | if (acpi_disabled) | ||
1535 | return 0; | ||
1536 | |||
1537 | memset(&ops, 0, sizeof(ops)); | 1534 | memset(&ops, 0, sizeof(ops)); |
1538 | ops.acpi_op_add = 1; | 1535 | ops.acpi_op_add = 1; |
1539 | ops.acpi_op_start = 1; | 1536 | ops.acpi_op_start = 1; |
@@ -1566,5 +1563,3 @@ static int __init acpi_scan_init(void) | |||
1566 | Done: | 1563 | Done: |
1567 | return result; | 1564 | return result; |
1568 | } | 1565 | } |
1569 | |||
1570 | 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 @@ | |||
21 | 21 | ||
22 | #include <acpi/acpi_bus.h> | 22 | #include <acpi/acpi_bus.h> |
23 | #include <acpi/acpi_drivers.h> | 23 | #include <acpi/acpi_drivers.h> |
24 | |||
25 | #include "internal.h" | ||
24 | #include "sleep.h" | 26 | #include "sleep.h" |
25 | 27 | ||
26 | u8 sleep_states[ACPI_S_STATE_COUNT]; | 28 | 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) | |||
571 | } | 571 | } |
572 | #endif | 572 | #endif |
573 | 573 | ||
574 | static int __init acpi_system_init(void) | 574 | int __init acpi_system_init(void) |
575 | { | 575 | { |
576 | int result = 0; | 576 | int result; |
577 | |||
578 | if (acpi_disabled) | ||
579 | return 0; | ||
580 | 577 | ||
581 | result = acpi_system_procfs_init(); | 578 | result = acpi_system_procfs_init(); |
582 | if (result) | 579 | if (result) |
@@ -586,5 +583,3 @@ static int __init acpi_system_init(void) | |||
586 | 583 | ||
587 | return result; | 584 | return result; |
588 | } | 585 | } |
589 | |||
590 | 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 @@ | |||
8 | #include <acpi/acpi_drivers.h> | 8 | #include <acpi/acpi_drivers.h> |
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | |||
12 | #include "internal.h" | ||
11 | #include "sleep.h" | 13 | #include "sleep.h" |
12 | 14 | ||
13 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 15 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
@@ -136,13 +138,10 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
136 | spin_unlock(&acpi_device_lock); | 138 | spin_unlock(&acpi_device_lock); |
137 | } | 139 | } |
138 | 140 | ||
139 | static int __init acpi_wakeup_device_init(void) | 141 | int __init acpi_wakeup_device_init(void) |
140 | { | 142 | { |
141 | struct list_head *node, *next; | 143 | struct list_head *node, *next; |
142 | 144 | ||
143 | if (acpi_disabled) | ||
144 | return 0; | ||
145 | |||
146 | spin_lock(&acpi_device_lock); | 145 | spin_lock(&acpi_device_lock); |
147 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 146 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
148 | struct acpi_device *dev = container_of(node, | 147 | struct acpi_device *dev = container_of(node, |
@@ -163,5 +162,3 @@ static int __init acpi_wakeup_device_init(void) | |||
163 | spin_unlock(&acpi_device_lock); | 162 | spin_unlock(&acpi_device_lock); |
164 | return 0; | 163 | return 0; |
165 | } | 164 | } |
166 | |||
167 | late_initcall(acpi_wakeup_device_init); | ||