aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2009-04-05 01:38:31 -0400
committerLen Brown <len.brown@intel.com>2009-04-05 01:38:31 -0400
commit9a38f4eec57cc5104b6a85bc6d0a91b268fbe803 (patch)
treeda01b5dd92d4076878003a8886fc2c9265e578f5 /drivers/acpi
parent67dc092187626ac55a60877485f78bc291cbfa81 (diff)
parent018f452e9d9d0cb5c3e8d33fd94dc6cd3c520a8f (diff)
Merge branch 'bjorn-initcall-cleanup' into release
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/Makefile8
-rw-r--r--drivers/acpi/bus.c15
-rw-r--r--drivers/acpi/debug.c14
-rw-r--r--drivers/acpi/ec.c7
-rw-r--r--drivers/acpi/glue.c6
-rw-r--r--drivers/acpi/internal.h43
-rw-r--r--drivers/acpi/power.c8
-rw-r--r--drivers/acpi/proc.c7
-rw-r--r--drivers/acpi/scan.c11
-rw-r--r--drivers/acpi/sleep.c2
-rw-r--r--drivers/acpi/system.c9
-rw-r--r--drivers/acpi/wakeup.c9
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
32processor-objs += processor_perflib.o 32processor-objs += processor_perflib.o
33endif 33endif
34 34
35obj-y += bus.o glue.o 35obj-y += bus.o glue.o scan.o ec.o \
36obj-y += scan.o 36 power.o system.o event.o
37# Keep EC driver first. Initialization of others depend on it.
38obj-y += ec.o
39obj-$(CONFIG_ACPI_AC) += ac.o 37obj-$(CONFIG_ACPI_AC) += ac.o
40obj-$(CONFIG_ACPI_BATTERY) += battery.o 38obj-$(CONFIG_ACPI_BATTERY) += battery.o
41obj-$(CONFIG_ACPI_BUTTON) += button.o 39obj-$(CONFIG_ACPI_BUTTON) += button.o
@@ -51,8 +49,6 @@ obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o
51obj-$(CONFIG_ACPI_PROCESSOR) += processor.o 49obj-$(CONFIG_ACPI_PROCESSOR) += processor.o
52obj-$(CONFIG_ACPI_CONTAINER) += container.o 50obj-$(CONFIG_ACPI_CONTAINER) += container.o
53obj-$(CONFIG_ACPI_THERMAL) += thermal.o 51obj-$(CONFIG_ACPI_THERMAL) += thermal.o
54obj-y += power.o
55obj-y += system.o event.o
56obj-$(CONFIG_ACPI_DEBUG) += debug.o 52obj-$(CONFIG_ACPI_DEBUG) += debug.o
57obj-$(CONFIG_ACPI_NUMA) += numa.o 53obj-$(CONFIG_ACPI_NUMA) += numa.o
58obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o 54obj-$(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
43ACPI_MODULE_NAME("bus"); 45ACPI_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
301static int __init acpi_debug_init(void) 302int __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;
343subsys_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
1072static int __init acpi_ec_init(void) 1072int __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
1093subsys_initcall(acpi_ec_init);
1094
1095/* EC driver currently not unloadable */ 1090/* EC driver currently not unloadable */
1096#if 0 1091#if 0
1097static void __exit acpi_ec_exit(void) 1092static 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
289static int __init init_acpi_device_notify(void) 289int __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
302arch_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
3int init_acpi_device_notify(void);
4int acpi_scan_init(void);
5int acpi_system_init(void);
6
7#ifdef CONFIG_ACPI_DEBUG
8int acpi_debug_init(void);
9#else
10static inline int acpi_debug_init(void) { return 0; }
11#endif
12
13/* --------------------------------------------------------------------------
14 Power Resource
15 -------------------------------------------------------------------------- */
16int acpi_power_init(void);
17int acpi_device_sleep_wake(struct acpi_device *dev,
18 int enable, int sleep_state, int dev_state);
19int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state);
20int acpi_disable_wakeup_device_power(struct acpi_device *dev);
21int acpi_power_get_inferred_state(struct acpi_device *device);
22int acpi_power_transition(struct acpi_device *device, int state);
23extern int acpi_power_nocheck;
24
25int acpi_wakeup_device_init(void);
26
27/* --------------------------------------------------------------------------
28 Embedded Controller
29 -------------------------------------------------------------------------- */
30int acpi_ec_init(void);
31int acpi_ec_ecdt_probe(void);
32int acpi_boot_ec_enable(void);
33
34/*--------------------------------------------------------------------------
35 Suspend/Resume
36 -------------------------------------------------------------------------- */
37extern int acpi_sleep_init(void);
38
39#ifdef CONFIG_ACPI_SLEEP
40int acpi_sleep_proc_init(void);
41#else
42static 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
776static int __init acpi_power_init(void) 776int __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
799subsys_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
499static int __init acpi_sleep_proc_init(void) 499int __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
531late_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
15ACPI_MODULE_NAME("scan"); 17ACPI_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 1529int __init acpi_scan_init(void)
1528static 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
1570subsys_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
26u8 sleep_states[ACPI_S_STATE_COUNT]; 28u8 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
574static int __init acpi_system_init(void) 574int __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
590subsys_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
139static int __init acpi_wakeup_device_init(void) 141int __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
167late_initcall(acpi_wakeup_device_init);