diff options
author | Zhang Rui <rui.zhang@intel.com> | 2010-07-14 22:46:15 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-08-14 23:02:00 -0400 |
commit | a25ee9200eef07377e1703697afbb5d81f89e500 (patch) | |
tree | efecbc42b6a600ee17c81951834d88f1ad0566e3 /drivers/acpi/debug.c | |
parent | 9fe6206f400646a2322096b56c59891d530e8d51 (diff) |
ACPI: introduce drivers/acpi/debugfs.c
Introduce drivers/acpi/debugfs.c.
Code for ACPI debugfs I/F,
i.e. /sys/kernel/debug/acpi/custom_method,
is moved to this file.
And make ACPI debugfs always built in,
even if CONFIG_ACPI_DEBUG is cleared.
BTW:this adds about 400bytes code to ACPI, when
CONFIG_ACPI_DEBUG is cleared.
[uaccess.h build fix from Andrew Morton <akpm@linux-foundation.org>]
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/debug.c')
-rw-r--r-- | drivers/acpi/debug.c | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c index 146135e7a6a1..22476eab2b08 100644 --- a/drivers/acpi/debug.c +++ b/drivers/acpi/debug.c | |||
@@ -198,80 +198,6 @@ module_param_call(trace_state, param_set_trace_state, param_get_trace_state, | |||
198 | NULL, 0644); | 198 | NULL, 0644); |
199 | 199 | ||
200 | /* -------------------------------------------------------------------------- | 200 | /* -------------------------------------------------------------------------- |
201 | DebugFS Interface | ||
202 | -------------------------------------------------------------------------- */ | ||
203 | |||
204 | static ssize_t cm_write(struct file *file, const char __user *user_buf, | ||
205 | size_t count, loff_t *ppos) | ||
206 | { | ||
207 | static char *buf; | ||
208 | static int uncopied_bytes; | ||
209 | struct acpi_table_header table; | ||
210 | acpi_status status; | ||
211 | |||
212 | if (!(*ppos)) { | ||
213 | /* parse the table header to get the table length */ | ||
214 | if (count <= sizeof(struct acpi_table_header)) | ||
215 | return -EINVAL; | ||
216 | if (copy_from_user(&table, user_buf, | ||
217 | sizeof(struct acpi_table_header))) | ||
218 | return -EFAULT; | ||
219 | uncopied_bytes = table.length; | ||
220 | buf = kzalloc(uncopied_bytes, GFP_KERNEL); | ||
221 | if (!buf) | ||
222 | return -ENOMEM; | ||
223 | } | ||
224 | |||
225 | if (uncopied_bytes < count) { | ||
226 | kfree(buf); | ||
227 | return -EINVAL; | ||
228 | } | ||
229 | |||
230 | if (copy_from_user(buf + (*ppos), user_buf, count)) { | ||
231 | kfree(buf); | ||
232 | return -EFAULT; | ||
233 | } | ||
234 | |||
235 | uncopied_bytes -= count; | ||
236 | *ppos += count; | ||
237 | |||
238 | if (!uncopied_bytes) { | ||
239 | status = acpi_install_method(buf); | ||
240 | kfree(buf); | ||
241 | if (ACPI_FAILURE(status)) | ||
242 | return -EINVAL; | ||
243 | add_taint(TAINT_OVERRIDDEN_ACPI_TABLE); | ||
244 | } | ||
245 | |||
246 | return count; | ||
247 | } | ||
248 | |||
249 | static const struct file_operations cm_fops = { | ||
250 | .write = cm_write, | ||
251 | }; | ||
252 | |||
253 | static int acpi_debugfs_init(void) | ||
254 | { | ||
255 | struct dentry *acpi_dir, *cm_dentry; | ||
256 | |||
257 | acpi_dir = debugfs_create_dir("acpi", NULL); | ||
258 | if (!acpi_dir) | ||
259 | goto err; | ||
260 | |||
261 | cm_dentry = debugfs_create_file("custom_method", S_IWUGO, | ||
262 | acpi_dir, NULL, &cm_fops); | ||
263 | if (!cm_dentry) | ||
264 | goto err; | ||
265 | |||
266 | return 0; | ||
267 | |||
268 | err: | ||
269 | if (acpi_dir) | ||
270 | debugfs_remove(acpi_dir); | ||
271 | return -EINVAL; | ||
272 | } | ||
273 | |||
274 | /* -------------------------------------------------------------------------- | ||
275 | FS Interface (/proc) | 201 | FS Interface (/proc) |
276 | -------------------------------------------------------------------------- */ | 202 | -------------------------------------------------------------------------- */ |
277 | #ifdef CONFIG_ACPI_PROCFS | 203 | #ifdef CONFIG_ACPI_PROCFS |
@@ -400,7 +326,6 @@ int __init acpi_procfs_init(void) | |||
400 | 326 | ||
401 | int __init acpi_debug_init(void) | 327 | int __init acpi_debug_init(void) |
402 | { | 328 | { |
403 | acpi_debugfs_init(); | ||
404 | acpi_procfs_init(); | 329 | acpi_procfs_init(); |
405 | return 0; | 330 | return 0; |
406 | } | 331 | } |