diff options
Diffstat (limited to 'drivers/acpi/system.c')
-rw-r--r-- | drivers/acpi/system.c | 170 |
1 files changed, 0 insertions, 170 deletions
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 | } | ||