diff options
author | Zhang Rui <rui.zhang@intel.com> | 2010-07-14 22:46:33 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-08-15 00:27:51 -0400 |
commit | 47f5c892b06797336a34f1096b4b617623aa1960 (patch) | |
tree | 31613e2031b8b5ac40b48dc5f8d673c8dbe5ead6 | |
parent | 1c8fce27e275fd7c6b75bc6455745f02d3903ee6 (diff) |
ACPI: remove deprecated ACPI procfs I/F
Rmove deprecated ACPI procfs I/F, including
/proc/acpi/debug_layer
/proc/acpi/debug_level
/proc/acpi/info
/proc/acpi/dsdt
/proc/acpi/fadt
/proc/acpi/sleep
because the sysfs I/F is already available
and has been working well for years.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | drivers/acpi/Kconfig | 6 | ||||
-rw-r--r-- | drivers/acpi/Makefile | 3 | ||||
-rw-r--r-- | drivers/acpi/bus.c | 2 | ||||
-rw-r--r-- | drivers/acpi/debug.c | 227 | ||||
-rw-r--r-- | drivers/acpi/internal.h | 7 | ||||
-rw-r--r-- | drivers/acpi/proc.c | 70 | ||||
-rw-r--r-- | drivers/acpi/system.c | 170 |
7 files changed, 1 insertions, 484 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 746411518802..d77d9c27c846 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -54,12 +54,6 @@ config ACPI_PROCFS | |||
54 | they have been replaced by functions in /sys. | 54 | they have been replaced by functions in /sys. |
55 | The deprecated files (and their replacements) include: | 55 | The deprecated files (and their replacements) include: |
56 | 56 | ||
57 | /proc/acpi/sleep (/sys/power/state) | ||
58 | /proc/acpi/info (/sys/module/acpi/parameters/acpica_version) | ||
59 | /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) | ||
60 | /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) | ||
61 | /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) | ||
62 | /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level) | ||
63 | /proc/acpi/processor/*/power (/sys/devices/system/cpu/*/cpuidle/*) | 57 | /proc/acpi/processor/*/power (/sys/devices/system/cpu/*/cpuidle/*) |
64 | /proc/acpi/processor/*/performance (/sys/devices/system/cpu/*/ | 58 | /proc/acpi/processor/*/performance (/sys/devices/system/cpu/*/ |
65 | cpufreq/*) | 59 | cpufreq/*) |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 03a81a844d23..3f0449622e69 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -37,9 +37,8 @@ acpi-y += ec.o | |||
37 | acpi-$(CONFIG_ACPI_DOCK) += dock.o | 37 | acpi-$(CONFIG_ACPI_DOCK) += dock.o |
38 | acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o | 38 | acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o |
39 | acpi-y += power.o | 39 | acpi-y += power.o |
40 | acpi-y += system.o event.o | 40 | acpi-y += event.o |
41 | acpi-y += sysfs.o | 41 | acpi-y += sysfs.o |
42 | acpi-$(CONFIG_ACPI_DEBUG) += debug.o | ||
43 | acpi-$(CONFIG_DEBUG_FS) += debugfs.o | 42 | acpi-$(CONFIG_DEBUG_FS) += debugfs.o |
44 | acpi-$(CONFIG_ACPI_NUMA) += numa.o | 43 | acpi-$(CONFIG_ACPI_NUMA) += numa.o |
45 | acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o | 44 | acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index bd9708b0f3f3..5c221ab535d5 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -1034,8 +1034,6 @@ static int __init acpi_init(void) | |||
1034 | acpi_scan_init(); | 1034 | acpi_scan_init(); |
1035 | acpi_ec_init(); | 1035 | acpi_ec_init(); |
1036 | acpi_power_init(); | 1036 | acpi_power_init(); |
1037 | acpi_system_init(); | ||
1038 | acpi_debug_init(); | ||
1039 | acpi_sysfs_init(); | 1037 | acpi_sysfs_init(); |
1040 | acpi_debugfs_init(); | 1038 | acpi_debugfs_init(); |
1041 | acpi_sleep_proc_init(); | 1039 | acpi_sleep_proc_init(); |
diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c deleted file mode 100644 index f82240dbbba3..000000000000 --- a/drivers/acpi/debug.c +++ /dev/null | |||
@@ -1,227 +0,0 @@ | |||
1 | /* | ||
2 | * debug.c - ACPI debug interface to userspace. | ||
3 | */ | ||
4 | |||
5 | #include <linux/proc_fs.h> | ||
6 | #include <linux/seq_file.h> | ||
7 | #include <linux/init.h> | ||
8 | #include <linux/module.h> | ||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/moduleparam.h> | ||
11 | #include <linux/debugfs.h> | ||
12 | #include <linux/slab.h> | ||
13 | #include <asm/uaccess.h> | ||
14 | #include <acpi/acpi_drivers.h> | ||
15 | |||
16 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | ||
17 | ACPI_MODULE_NAME("debug"); | ||
18 | |||
19 | struct acpi_dlayer { | ||
20 | const char *name; | ||
21 | unsigned long value; | ||
22 | }; | ||
23 | struct acpi_dlevel { | ||
24 | const char *name; | ||
25 | unsigned long value; | ||
26 | }; | ||
27 | #define ACPI_DEBUG_INIT(v) { .name = #v, .value = v } | ||
28 | |||
29 | static const struct acpi_dlayer acpi_debug_layers[] = { | ||
30 | ACPI_DEBUG_INIT(ACPI_UTILITIES), | ||
31 | ACPI_DEBUG_INIT(ACPI_HARDWARE), | ||
32 | ACPI_DEBUG_INIT(ACPI_EVENTS), | ||
33 | ACPI_DEBUG_INIT(ACPI_TABLES), | ||
34 | ACPI_DEBUG_INIT(ACPI_NAMESPACE), | ||
35 | ACPI_DEBUG_INIT(ACPI_PARSER), | ||
36 | ACPI_DEBUG_INIT(ACPI_DISPATCHER), | ||
37 | ACPI_DEBUG_INIT(ACPI_EXECUTER), | ||
38 | ACPI_DEBUG_INIT(ACPI_RESOURCES), | ||
39 | ACPI_DEBUG_INIT(ACPI_CA_DEBUGGER), | ||
40 | ACPI_DEBUG_INIT(ACPI_OS_SERVICES), | ||
41 | ACPI_DEBUG_INIT(ACPI_CA_DISASSEMBLER), | ||
42 | ACPI_DEBUG_INIT(ACPI_COMPILER), | ||
43 | ACPI_DEBUG_INIT(ACPI_TOOLS), | ||
44 | |||
45 | ACPI_DEBUG_INIT(ACPI_BUS_COMPONENT), | ||
46 | ACPI_DEBUG_INIT(ACPI_AC_COMPONENT), | ||
47 | ACPI_DEBUG_INIT(ACPI_BATTERY_COMPONENT), | ||
48 | ACPI_DEBUG_INIT(ACPI_BUTTON_COMPONENT), | ||
49 | ACPI_DEBUG_INIT(ACPI_SBS_COMPONENT), | ||
50 | ACPI_DEBUG_INIT(ACPI_FAN_COMPONENT), | ||
51 | ACPI_DEBUG_INIT(ACPI_PCI_COMPONENT), | ||
52 | ACPI_DEBUG_INIT(ACPI_POWER_COMPONENT), | ||
53 | ACPI_DEBUG_INIT(ACPI_CONTAINER_COMPONENT), | ||
54 | ACPI_DEBUG_INIT(ACPI_SYSTEM_COMPONENT), | ||
55 | ACPI_DEBUG_INIT(ACPI_THERMAL_COMPONENT), | ||
56 | ACPI_DEBUG_INIT(ACPI_MEMORY_DEVICE_COMPONENT), | ||
57 | ACPI_DEBUG_INIT(ACPI_VIDEO_COMPONENT), | ||
58 | ACPI_DEBUG_INIT(ACPI_PROCESSOR_COMPONENT), | ||
59 | }; | ||
60 | |||
61 | static const struct acpi_dlevel acpi_debug_levels[] = { | ||
62 | ACPI_DEBUG_INIT(ACPI_LV_INIT), | ||
63 | ACPI_DEBUG_INIT(ACPI_LV_DEBUG_OBJECT), | ||
64 | ACPI_DEBUG_INIT(ACPI_LV_INFO), | ||
65 | |||
66 | ACPI_DEBUG_INIT(ACPI_LV_INIT_NAMES), | ||
67 | ACPI_DEBUG_INIT(ACPI_LV_PARSE), | ||
68 | ACPI_DEBUG_INIT(ACPI_LV_LOAD), | ||
69 | ACPI_DEBUG_INIT(ACPI_LV_DISPATCH), | ||
70 | ACPI_DEBUG_INIT(ACPI_LV_EXEC), | ||
71 | ACPI_DEBUG_INIT(ACPI_LV_NAMES), | ||
72 | ACPI_DEBUG_INIT(ACPI_LV_OPREGION), | ||
73 | ACPI_DEBUG_INIT(ACPI_LV_BFIELD), | ||
74 | ACPI_DEBUG_INIT(ACPI_LV_TABLES), | ||
75 | ACPI_DEBUG_INIT(ACPI_LV_VALUES), | ||
76 | ACPI_DEBUG_INIT(ACPI_LV_OBJECTS), | ||
77 | ACPI_DEBUG_INIT(ACPI_LV_RESOURCES), | ||
78 | ACPI_DEBUG_INIT(ACPI_LV_USER_REQUESTS), | ||
79 | ACPI_DEBUG_INIT(ACPI_LV_PACKAGE), | ||
80 | |||
81 | ACPI_DEBUG_INIT(ACPI_LV_ALLOCATIONS), | ||
82 | ACPI_DEBUG_INIT(ACPI_LV_FUNCTIONS), | ||
83 | ACPI_DEBUG_INIT(ACPI_LV_OPTIMIZATIONS), | ||
84 | |||
85 | ACPI_DEBUG_INIT(ACPI_LV_MUTEX), | ||
86 | ACPI_DEBUG_INIT(ACPI_LV_THREADS), | ||
87 | ACPI_DEBUG_INIT(ACPI_LV_IO), | ||
88 | ACPI_DEBUG_INIT(ACPI_LV_INTERRUPTS), | ||
89 | |||
90 | ACPI_DEBUG_INIT(ACPI_LV_AML_DISASSEMBLE), | ||
91 | ACPI_DEBUG_INIT(ACPI_LV_VERBOSE_INFO), | ||
92 | ACPI_DEBUG_INIT(ACPI_LV_FULL_TABLES), | ||
93 | ACPI_DEBUG_INIT(ACPI_LV_EVENTS), | ||
94 | }; | ||
95 | |||
96 | /* -------------------------------------------------------------------------- | ||
97 | FS Interface (/proc) | ||
98 | -------------------------------------------------------------------------- */ | ||
99 | #ifdef CONFIG_ACPI_PROCFS | ||
100 | #define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer" | ||
101 | #define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level" | ||
102 | |||
103 | static int acpi_system_debug_proc_show(struct seq_file *m, void *v) | ||
104 | { | ||
105 | unsigned int i; | ||
106 | |||
107 | seq_printf(m, "%-25s\tHex SET\n", "Description"); | ||
108 | |||
109 | switch ((unsigned long)m->private) { | ||
110 | case 0: | ||
111 | for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) { | ||
112 | seq_printf(m, "%-25s\t0x%08lX [%c]\n", | ||
113 | acpi_debug_layers[i].name, | ||
114 | acpi_debug_layers[i].value, | ||
115 | (acpi_dbg_layer & acpi_debug_layers[i]. | ||
116 | value) ? '*' : ' '); | ||
117 | } | ||
118 | seq_printf(m, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS", | ||
119 | ACPI_ALL_DRIVERS, | ||
120 | (acpi_dbg_layer & ACPI_ALL_DRIVERS) == | ||
121 | ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer & | ||
122 | ACPI_ALL_DRIVERS) == | ||
123 | 0 ? ' ' : '-'); | ||
124 | seq_printf(m, | ||
125 | "--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n", | ||
126 | acpi_dbg_layer); | ||
127 | break; | ||
128 | case 1: | ||
129 | for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) { | ||
130 | seq_printf(m, "%-25s\t0x%08lX [%c]\n", | ||
131 | acpi_debug_levels[i].name, | ||
132 | acpi_debug_levels[i].value, | ||
133 | (acpi_dbg_level & acpi_debug_levels[i]. | ||
134 | value) ? '*' : ' '); | ||
135 | } | ||
136 | seq_printf(m, "--\ndebug_level = 0x%08X (* = enabled)\n", | ||
137 | acpi_dbg_level); | ||
138 | break; | ||
139 | } | ||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | static int acpi_system_debug_proc_open(struct inode *inode, struct file *file) | ||
144 | { | ||
145 | return single_open(file, acpi_system_debug_proc_show, PDE(inode)->data); | ||
146 | } | ||
147 | |||
148 | static ssize_t acpi_system_debug_proc_write(struct file *file, | ||
149 | const char __user * buffer, | ||
150 | size_t count, loff_t *pos) | ||
151 | { | ||
152 | char debug_string[12] = { '\0' }; | ||
153 | |||
154 | |||
155 | if (count > sizeof(debug_string) - 1) | ||
156 | return -EINVAL; | ||
157 | |||
158 | if (copy_from_user(debug_string, buffer, count)) | ||
159 | return -EFAULT; | ||
160 | |||
161 | debug_string[count] = '\0'; | ||
162 | |||
163 | switch ((unsigned long)PDE(file->f_path.dentry->d_inode)->data) { | ||
164 | case 0: | ||
165 | acpi_dbg_layer = simple_strtoul(debug_string, NULL, 0); | ||
166 | break; | ||
167 | case 1: | ||
168 | acpi_dbg_level = simple_strtoul(debug_string, NULL, 0); | ||
169 | break; | ||
170 | default: | ||
171 | return -EINVAL; | ||
172 | } | ||
173 | |||
174 | return count; | ||
175 | } | ||
176 | |||
177 | static const struct file_operations acpi_system_debug_proc_fops = { | ||
178 | .owner = THIS_MODULE, | ||
179 | .open = acpi_system_debug_proc_open, | ||
180 | .read = seq_read, | ||
181 | .llseek = seq_lseek, | ||
182 | .release = single_release, | ||
183 | .write = acpi_system_debug_proc_write, | ||
184 | }; | ||
185 | #endif | ||
186 | |||
187 | int __init acpi_procfs_init(void) | ||
188 | { | ||
189 | #ifdef CONFIG_ACPI_PROCFS | ||
190 | struct proc_dir_entry *entry; | ||
191 | int error = 0; | ||
192 | char *name; | ||
193 | |||
194 | /* 'debug_layer' [R/W] */ | ||
195 | name = ACPI_SYSTEM_FILE_DEBUG_LAYER; | ||
196 | entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUSR, | ||
197 | acpi_root_dir, &acpi_system_debug_proc_fops, | ||
198 | (void *)0); | ||
199 | if (!entry) | ||
200 | goto Error; | ||
201 | |||
202 | /* 'debug_level' [R/W] */ | ||
203 | name = ACPI_SYSTEM_FILE_DEBUG_LEVEL; | ||
204 | entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUSR, | ||
205 | acpi_root_dir, &acpi_system_debug_proc_fops, | ||
206 | (void *)1); | ||
207 | if (!entry) | ||
208 | goto Error; | ||
209 | |||
210 | Done: | ||
211 | return error; | ||
212 | |||
213 | Error: | ||
214 | remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir); | ||
215 | remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir); | ||
216 | error = -ENODEV; | ||
217 | goto Done; | ||
218 | #else | ||
219 | return 0; | ||
220 | #endif | ||
221 | } | ||
222 | |||
223 | int __init acpi_debug_init(void) | ||
224 | { | ||
225 | acpi_procfs_init(); | ||
226 | return 0; | ||
227 | } | ||
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index eed823418559..e37964439d66 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -22,15 +22,8 @@ | |||
22 | 22 | ||
23 | int init_acpi_device_notify(void); | 23 | int init_acpi_device_notify(void); |
24 | int acpi_scan_init(void); | 24 | int acpi_scan_init(void); |
25 | int acpi_system_init(void); | ||
26 | int acpi_sysfs_init(void); | 25 | int acpi_sysfs_init(void); |
27 | 26 | ||
28 | #ifdef CONFIG_ACPI_DEBUG | ||
29 | int acpi_debug_init(void); | ||
30 | #else | ||
31 | static inline int acpi_debug_init(void) { return 0; } | ||
32 | #endif | ||
33 | |||
34 | #ifdef CONFIG_DEBUG_FS | 27 | #ifdef CONFIG_DEBUG_FS |
35 | int acpi_debugfs_init(void); | 28 | int acpi_debugfs_init(void); |
36 | #else | 29 | #else |
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index 1ac678d2c51c..afad67769db6 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c | |||
@@ -17,64 +17,11 @@ | |||
17 | 17 | ||
18 | /* | 18 | /* |
19 | * this file provides support for: | 19 | * this file provides support for: |
20 | * /proc/acpi/sleep | ||
21 | * /proc/acpi/alarm | 20 | * /proc/acpi/alarm |
22 | * /proc/acpi/wakeup | 21 | * /proc/acpi/wakeup |
23 | */ | 22 | */ |
24 | 23 | ||
25 | ACPI_MODULE_NAME("sleep") | 24 | ACPI_MODULE_NAME("sleep") |
26 | #ifdef CONFIG_ACPI_PROCFS | ||
27 | static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset) | ||
28 | { | ||
29 | int i; | ||
30 | |||
31 | for (i = 0; i <= ACPI_STATE_S5; i++) { | ||
32 | if (sleep_states[i]) { | ||
33 | seq_printf(seq, "S%d ", i); | ||
34 | } | ||
35 | } | ||
36 | |||
37 | seq_puts(seq, "\n"); | ||
38 | |||
39 | return 0; | ||
40 | } | ||
41 | |||
42 | static int acpi_system_sleep_open_fs(struct inode *inode, struct file *file) | ||
43 | { | ||
44 | return single_open(file, acpi_system_sleep_seq_show, PDE(inode)->data); | ||
45 | } | ||
46 | |||
47 | static ssize_t | ||
48 | acpi_system_write_sleep(struct file *file, | ||
49 | const char __user * buffer, size_t count, loff_t * ppos) | ||
50 | { | ||
51 | char str[12]; | ||
52 | u32 state = 0; | ||
53 | int error = 0; | ||
54 | |||
55 | if (count > sizeof(str) - 1) | ||
56 | goto Done; | ||
57 | memset(str, 0, sizeof(str)); | ||
58 | if (copy_from_user(str, buffer, count)) | ||
59 | return -EFAULT; | ||
60 | |||
61 | /* Check for S4 bios request */ | ||
62 | if (!strcmp(str, "4b")) { | ||
63 | error = acpi_suspend(4); | ||
64 | goto Done; | ||
65 | } | ||
66 | state = simple_strtoul(str, NULL, 0); | ||
67 | #ifdef CONFIG_HIBERNATION | ||
68 | if (state == 4) { | ||
69 | error = hibernate(); | ||
70 | goto Done; | ||
71 | } | ||
72 | #endif | ||
73 | error = acpi_suspend(state); | ||
74 | Done: | ||
75 | return error ? error : count; | ||
76 | } | ||
77 | #endif /* CONFIG_ACPI_PROCFS */ | ||
78 | 25 | ||
79 | #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || !defined(CONFIG_X86) | 26 | #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || !defined(CONFIG_X86) |
80 | /* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */ | 27 | /* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */ |
@@ -463,17 +410,6 @@ static const struct file_operations acpi_system_wakeup_device_fops = { | |||
463 | .release = single_release, | 410 | .release = single_release, |
464 | }; | 411 | }; |
465 | 412 | ||
466 | #ifdef CONFIG_ACPI_PROCFS | ||
467 | static const struct file_operations acpi_system_sleep_fops = { | ||
468 | .owner = THIS_MODULE, | ||
469 | .open = acpi_system_sleep_open_fs, | ||
470 | .read = seq_read, | ||
471 | .write = acpi_system_write_sleep, | ||
472 | .llseek = seq_lseek, | ||
473 | .release = single_release, | ||
474 | }; | ||
475 | #endif /* CONFIG_ACPI_PROCFS */ | ||
476 | |||
477 | #ifdef HAVE_ACPI_LEGACY_ALARM | 413 | #ifdef HAVE_ACPI_LEGACY_ALARM |
478 | static const struct file_operations acpi_system_alarm_fops = { | 414 | static const struct file_operations acpi_system_alarm_fops = { |
479 | .owner = THIS_MODULE, | 415 | .owner = THIS_MODULE, |
@@ -495,12 +431,6 @@ static u32 rtc_handler(void *context) | |||
495 | 431 | ||
496 | int __init acpi_sleep_proc_init(void) | 432 | int __init acpi_sleep_proc_init(void) |
497 | { | 433 | { |
498 | #ifdef CONFIG_ACPI_PROCFS | ||
499 | /* 'sleep' [R/W] */ | ||
500 | proc_create("sleep", S_IFREG | S_IRUGO | S_IWUSR, | ||
501 | acpi_root_dir, &acpi_system_sleep_fops); | ||
502 | #endif /* CONFIG_ACPI_PROCFS */ | ||
503 | |||
504 | #ifdef HAVE_ACPI_LEGACY_ALARM | 434 | #ifdef HAVE_ACPI_LEGACY_ALARM |
505 | /* 'alarm' [R/W] */ | 435 | /* 'alarm' [R/W] */ |
506 | proc_create("alarm", S_IFREG | S_IRUGO | S_IWUSR, | 436 | proc_create("alarm", S_IFREG | S_IRUGO | S_IWUSR, |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c deleted file mode 100644 index d70481f32c89..000000000000 --- a/drivers/acpi/system.c +++ /dev/null | |||
@@ -1,170 +0,0 @@ | |||
1 | /* | ||
2 | * acpi_system.c - ACPI System Driver ($Revision: 63 $) | ||
3 | * | ||
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | ||
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | ||
6 | * | ||
7 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or (at | ||
12 | * your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along | ||
20 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
21 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
22 | * | ||
23 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
24 | */ | ||
25 | |||
26 | #include <linux/proc_fs.h> | ||
27 | #include <linux/seq_file.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/init.h> | ||
30 | #include <linux/string.h> | ||
31 | #include <asm/uaccess.h> | ||
32 | |||
33 | #include <acpi/acpi_drivers.h> | ||
34 | |||
35 | #define PREFIX "ACPI: " | ||
36 | |||
37 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | ||
38 | ACPI_MODULE_NAME("system"); | ||
39 | |||
40 | #define ACPI_SYSTEM_CLASS "system" | ||
41 | #define ACPI_SYSTEM_DEVICE_NAME "System" | ||
42 | |||
43 | /* -------------------------------------------------------------------------- | ||
44 | FS Interface (/proc) | ||
45 | -------------------------------------------------------------------------- */ | ||
46 | #ifdef CONFIG_ACPI_PROCFS | ||
47 | #define ACPI_SYSTEM_FILE_INFO "info" | ||
48 | #define ACPI_SYSTEM_FILE_EVENT "event" | ||
49 | #define ACPI_SYSTEM_FILE_DSDT "dsdt" | ||
50 | #define ACPI_SYSTEM_FILE_FADT "fadt" | ||
51 | |||
52 | static int acpi_system_read_info(struct seq_file *seq, void *offset) | ||
53 | { | ||
54 | |||
55 | seq_printf(seq, "version: %x\n", ACPI_CA_VERSION); | ||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | static int acpi_system_info_open_fs(struct inode *inode, struct file *file) | ||
60 | { | ||
61 | return single_open(file, acpi_system_read_info, PDE(inode)->data); | ||
62 | } | ||
63 | |||
64 | static const struct file_operations acpi_system_info_ops = { | ||
65 | .owner = THIS_MODULE, | ||
66 | .open = acpi_system_info_open_fs, | ||
67 | .read = seq_read, | ||
68 | .llseek = seq_lseek, | ||
69 | .release = single_release, | ||
70 | }; | ||
71 | |||
72 | static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t, | ||
73 | loff_t *); | ||
74 | |||
75 | static const struct file_operations acpi_system_dsdt_ops = { | ||
76 | .owner = THIS_MODULE, | ||
77 | .read = acpi_system_read_dsdt, | ||
78 | }; | ||
79 | |||
80 | static ssize_t | ||
81 | acpi_system_read_dsdt(struct file *file, | ||
82 | char __user * buffer, size_t count, loff_t * ppos) | ||
83 | { | ||
84 | acpi_status status = AE_OK; | ||
85 | struct acpi_table_header *dsdt = NULL; | ||
86 | ssize_t res; | ||
87 | |||
88 | status = acpi_get_table(ACPI_SIG_DSDT, 1, &dsdt); | ||
89 | if (ACPI_FAILURE(status)) | ||
90 | return -ENODEV; | ||
91 | |||
92 | res = simple_read_from_buffer(buffer, count, ppos, dsdt, dsdt->length); | ||
93 | |||
94 | return res; | ||
95 | } | ||
96 | |||
97 | static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t, | ||
98 | loff_t *); | ||
99 | |||
100 | static const struct file_operations acpi_system_fadt_ops = { | ||
101 | .owner = THIS_MODULE, | ||
102 | .read = acpi_system_read_fadt, | ||
103 | }; | ||
104 | |||
105 | static ssize_t | ||
106 | acpi_system_read_fadt(struct file *file, | ||
107 | char __user * buffer, size_t count, loff_t * ppos) | ||
108 | { | ||
109 | acpi_status status = AE_OK; | ||
110 | struct acpi_table_header *fadt = NULL; | ||
111 | ssize_t res; | ||
112 | |||
113 | status = acpi_get_table(ACPI_SIG_FADT, 1, &fadt); | ||
114 | if (ACPI_FAILURE(status)) | ||
115 | return -ENODEV; | ||
116 | |||
117 | res = simple_read_from_buffer(buffer, count, ppos, fadt, fadt->length); | ||
118 | |||
119 | return res; | ||
120 | } | ||
121 | |||
122 | static int acpi_system_procfs_init(void) | ||
123 | { | ||
124 | struct proc_dir_entry *entry; | ||
125 | int error = 0; | ||
126 | |||
127 | /* 'info' [R] */ | ||
128 | entry = proc_create(ACPI_SYSTEM_FILE_INFO, S_IRUGO, acpi_root_dir, | ||
129 | &acpi_system_info_ops); | ||
130 | if (!entry) | ||
131 | goto Error; | ||
132 | |||
133 | /* 'dsdt' [R] */ | ||
134 | entry = proc_create(ACPI_SYSTEM_FILE_DSDT, S_IRUSR, acpi_root_dir, | ||
135 | &acpi_system_dsdt_ops); | ||
136 | if (!entry) | ||
137 | goto Error; | ||
138 | |||
139 | /* 'fadt' [R] */ | ||
140 | entry = proc_create(ACPI_SYSTEM_FILE_FADT, S_IRUSR, acpi_root_dir, | ||
141 | &acpi_system_fadt_ops); | ||
142 | if (!entry) | ||
143 | goto Error; | ||
144 | |||
145 | Done: | ||
146 | return error; | ||
147 | |||
148 | Error: | ||
149 | remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir); | ||
150 | remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_root_dir); | ||
151 | remove_proc_entry(ACPI_SYSTEM_FILE_INFO, acpi_root_dir); | ||
152 | |||
153 | error = -EFAULT; | ||
154 | goto Done; | ||
155 | } | ||
156 | #else | ||
157 | static int acpi_system_procfs_init(void) | ||
158 | { | ||
159 | return 0; | ||
160 | } | ||
161 | #endif | ||
162 | |||
163 | int __init acpi_system_init(void) | ||
164 | { | ||
165 | int result; | ||
166 | |||
167 | result = acpi_system_procfs_init(); | ||
168 | |||
169 | return result; | ||
170 | } | ||