ACPI: Cleanup custom_method debug stuff
authorThomas Renninger <trenn@suse.de>
Thu, 26 May 2011 10:26:23 +0000 (12:26 +0200)
committerLen Brown <len.brown@intel.com>
Sun, 29 May 2011 05:50:04 +0000 (01:50 -0400)
- Move param aml_debug_output to other params into sysfs.c
- Split acpi_debugfs_init to prepare custom_method to be
  an own .config option and driver.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: rui.zhang@intel.com
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/debugfs.c
drivers/acpi/internal.h
drivers/acpi/sysfs.c

index 384f7abcff77984fb67c21c34b462761bc8f611e..e7abc6e3bba016faccb41606c75df5bc0461ecae 100644 (file)
 #define _COMPONENT             ACPI_SYSTEM_COMPONENT
 ACPI_MODULE_NAME("debugfs");
 
-
-/* /sys/modules/acpi/parameters/aml_debug_output */
-
-module_param_named(aml_debug_output, acpi_gbl_enable_aml_debug_object,
-                  bool, 0644);
-MODULE_PARM_DESC(aml_debug_output,
-                "To enable/disable the ACPI Debug Object output.");
+struct dentry *acpi_debugfs_dir;
+static struct dentry *cm_dentry;
 
 /* /sys/kernel/debug/acpi/custom_method */
 
@@ -80,23 +75,22 @@ static const struct file_operations cm_fops = {
        .llseek = default_llseek,
 };
 
-int __init acpi_debugfs_init(void)
+static int __init acpi_custom_method_init(void)
 {
-       struct dentry *acpi_dir, *cm_dentry;
-
-       acpi_dir = debugfs_create_dir("acpi", NULL);
-       if (!acpi_dir)
-               goto err;
+       if (!acpi_debugfs_dir)
+               return -ENOENT;
 
        cm_dentry = debugfs_create_file("custom_method", S_IWUSR,
-                                       acpi_dir, NULL, &cm_fops);
+                                       acpi_debugfs_dir, NULL, &cm_fops);
        if (!cm_dentry)
-               goto err;
+               return -ENODEV;
 
        return 0;
+}
+
+void __init acpi_debugfs_init(void)
+{
+       acpi_debugfs_dir = debugfs_create_dir("acpi", NULL);
 
-err:
-       if (acpi_dir)
-               debugfs_remove(acpi_dir);
-       return -EINVAL;
+       acpi_custom_method_init();
 }
index 4bfb759deb104e6febcf837a84d52c3cb39916a3..ca75b9ce0489f0fb1140d994ccf2476bf4935a60 100644 (file)
@@ -28,9 +28,10 @@ int acpi_scan_init(void);
 int acpi_sysfs_init(void);
 
 #ifdef CONFIG_DEBUG_FS
+extern struct dentry *acpi_debugfs_dir;
 int acpi_debugfs_init(void);
 #else
-static inline int acpi_debugfs_init(void) { return 0; }
+static inline void acpi_debugfs_init(void) { return; }
 #endif
 
 /* --------------------------------------------------------------------------
index 61891e75583da971f7973393fc9071b5ec14dfaa..77255f250dbb7c2afe29aabc640d5227fddf7d08 100644 (file)
@@ -220,6 +220,14 @@ module_param_call(trace_state, param_set_trace_state, param_get_trace_state,
                  NULL, 0644);
 #endif /* CONFIG_ACPI_DEBUG */
 
+
+/* /sys/modules/acpi/parameters/aml_debug_output */
+
+module_param_named(aml_debug_output, acpi_gbl_enable_aml_debug_object,
+                  bool, 0644);
+MODULE_PARM_DESC(aml_debug_output,
+                "To enable/disable the ACPI Debug Object output.");
+
 /* /sys/module/acpi/parameters/acpica_version */
 static int param_get_acpica_version(char *buffer, struct kernel_param *kp)
 {