Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / acpi / debug.c
index 2c0dac5..263322b 100644 (file)
 #include <acpi/acglobal.h>
 
 #define _COMPONENT             ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME               ("debug")
-
+ACPI_MODULE_NAME("debug")
 #define ACPI_SYSTEM_FILE_DEBUG_LAYER   "debug_layer"
 #define ACPI_SYSTEM_FILE_DEBUG_LEVEL   "debug_level"
-
 #ifdef MODULE_PARAM_PREFIX
 #undef MODULE_PARAM_PREFIX
 #endif
-
 #define MODULE_PARAM_PREFIX
-module_param(acpi_dbg_layer, uint, 0400);
+    module_param(acpi_dbg_layer, uint, 0400);
 module_param(acpi_dbg_level, uint, 0400);
 
 struct acpi_dlayer {
@@ -35,8 +32,7 @@ struct acpi_dlevel {
 };
 #define ACPI_DEBUG_INIT(v)     { .name = #v, .value = v }
 
-static const struct acpi_dlayer acpi_debug_layers[] =
-{
+static const struct acpi_dlayer acpi_debug_layers[] = {
        ACPI_DEBUG_INIT(ACPI_UTILITIES),
        ACPI_DEBUG_INIT(ACPI_HARDWARE),
        ACPI_DEBUG_INIT(ACPI_EVENTS),
@@ -53,8 +49,7 @@ static const struct acpi_dlayer acpi_debug_layers[] =
        ACPI_DEBUG_INIT(ACPI_TOOLS),
 };
 
-static const struct acpi_dlevel acpi_debug_levels[] =
-{
+static const struct acpi_dlevel acpi_debug_levels[] = {
        ACPI_DEBUG_INIT(ACPI_LV_ERROR),
        ACPI_DEBUG_INIT(ACPI_LV_WARN),
        ACPI_DEBUG_INIT(ACPI_LV_INIT),
@@ -88,81 +83,77 @@ static const struct acpi_dlevel acpi_debug_levels[] =
        ACPI_DEBUG_INIT(ACPI_LV_AML_DISASSEMBLE),
        ACPI_DEBUG_INIT(ACPI_LV_VERBOSE_INFO),
        ACPI_DEBUG_INIT(ACPI_LV_FULL_TABLES),
-       ACPI_DEBUG_INIT(ACPI_LV_EVENTS),             
+       ACPI_DEBUG_INIT(ACPI_LV_EVENTS),
 };
 
 static int
-acpi_system_read_debug (
-       char                    *page,
-       char                    **start,
-       off_t                   off,
-       int                     count,
-       int                     *eof,
-       void                    *data)
+acpi_system_read_debug(char *page,
+                      char **start, off_t off, int count, int *eof, void *data)
 {
-       char                    *p = page;
-       int                     size = 0;
-       unsigned int            i;
+       char *p = page;
+       int size = 0;
+       unsigned int i;
 
        if (off != 0)
                goto end;
 
        p += sprintf(p, "%-25s\tHex        SET\n", "Description");
 
-       switch ((unsigned long) data) {
+       switch ((unsigned long)data) {
        case 0:
                for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) {
                        p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
-                               acpi_debug_layers[i].name,
-                               acpi_debug_layers[i].value,
-                               (acpi_dbg_layer & acpi_debug_layers[i].value) ?
-                               '*' : ' ');
+                                    acpi_debug_layers[i].name,
+                                    acpi_debug_layers[i].value,
+                                    (acpi_dbg_layer & acpi_debug_layers[i].
+                                     value) ? '*' : ' ');
                }
                p += sprintf(p, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
-                       ACPI_ALL_DRIVERS,
-                       (acpi_dbg_layer & ACPI_ALL_DRIVERS) == ACPI_ALL_DRIVERS?
-                       '*' : (acpi_dbg_layer & ACPI_ALL_DRIVERS) == 0 ?
-                       ' ' : '-');
+                            ACPI_ALL_DRIVERS,
+                            (acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
+                            ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer &
+                                                      ACPI_ALL_DRIVERS) ==
+                            0 ? ' ' : '-');
                p += sprintf(p,
-                       "--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
-                       acpi_dbg_layer);
+                            "--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
+                            acpi_dbg_layer);
                break;
        case 1:
                for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
                        p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
-                               acpi_debug_levels[i].name,
-                               acpi_debug_levels[i].value,
-                               (acpi_dbg_level & acpi_debug_levels[i].value) ?
-                               '*' : ' ');
+                                    acpi_debug_levels[i].name,
+                                    acpi_debug_levels[i].value,
+                                    (acpi_dbg_level & acpi_debug_levels[i].
+                                     value) ? '*' : ' ');
                }
                p += sprintf(p, "--\ndebug_level = 0x%08X (* = enabled)\n",
-                               acpi_dbg_level);
+                            acpi_dbg_level);
                break;
        default:
                p += sprintf(p, "Invalid debug option\n");
                break;
        }
-       
-end:
+
+      end:
        size = (p - page);
-       if (size <= off+count) *eof = 1;
+       if (size <= off + count)
+               *eof = 1;
        *start = page + off;
        size -= off;
-       if (size>count) size = count;
-       if (size<0) size = 0;
+       if (size > count)
+               size = count;
+       if (size < 0)
+               size = 0;
 
        return size;
 }
 
-
 static int
-acpi_system_write_debug (
-       struct file             *file,
-        const char              __user *buffer,
-       unsigned long           count,
-        void                    *data)
+acpi_system_write_debug(struct file *file,
+                       const char __user * buffer,
+                       unsigned long count, void *data)
 {
-       char                    debug_string[12] = {'\0'};
+       char debug_string[12] = { '\0' };
 
        ACPI_FUNCTION_TRACE("acpi_system_write_debug");
 
@@ -174,7 +165,7 @@ acpi_system_write_debug (
 
        debug_string[count] = '\0';
 
-       switch ((unsigned long) data) {
+       switch ((unsigned long)data) {
        case 0:
                acpi_dbg_layer = simple_strtoul(debug_string, NULL, 0);
                break;
@@ -190,9 +181,9 @@ acpi_system_write_debug (
 
 static int __init acpi_debug_init(void)
 {
-       struct proc_dir_entry   *entry;
+       struct proc_dir_entry *entry;
        int error = 0;
-       char * name;
+       char *name;
 
        ACPI_FUNCTION_TRACE("acpi_debug_init");
 
@@ -201,8 +192,10 @@ static int __init acpi_debug_init(void)
 
        /* 'debug_layer' [R/W] */
        name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
-       entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
-                                      acpi_system_read_debug,(void *)0);
+       entry =
+           create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
+                                  acpi_root_dir, acpi_system_read_debug,
+                                  (void *)0);
        if (entry)
                entry->write_proc = acpi_system_write_debug;
        else
@@ -210,19 +203,21 @@ static int __init acpi_debug_init(void)
 
        /* 'debug_level' [R/W] */
        name = ACPI_SYSTEM_FILE_DEBUG_LEVEL;
-       entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
-                                      acpi_system_read_debug, (void *)1);
-       if (entry) 
+       entry =
+           create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
+                                  acpi_root_dir, acpi_system_read_debug,
+                                  (void *)1);
+       if (entry)
                entry->write_proc = acpi_system_write_debug;
        else
                goto Error;
 
- Done:
     Done:
        return_VALUE(error);
 
- Error:
-       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                        "Unable to create '%s' proc fs entry\n", name));
     Error:
+       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                         "Unable to create '%s' proc fs entry\n", name));
 
        remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir);
        remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir);