Merge branch 'bkl/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic...
[safe/jmp/linux-2.6] / drivers / acpi / system.c
index 44be75e..c79e789 100644 (file)
 
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/string.h>
 #include <asm/uaccess.h>
 
 #include <acpi/acpi_drivers.h>
 
+#define PREFIX "ACPI: "
+
 #define _COMPONENT             ACPI_SYSTEM_COMPONENT
 ACPI_MODULE_NAME("system");
-#ifdef MODULE_PARAM_PREFIX
-#undef MODULE_PARAM_PREFIX
-#endif
-#define MODULE_PARAM_PREFIX "acpi."
 
 #define ACPI_SYSTEM_CLASS              "system"
 #define ACPI_SYSTEM_DEVICE_NAME                "System"
 
 u32 acpi_irq_handled;
+u32 acpi_irq_not_handled;
 
 /*
  * Make ACPICA version work as module param
@@ -71,7 +71,7 @@ struct acpi_table_attr {
        struct list_head node;
 };
 
-static ssize_t acpi_table_show(struct kobject *kobj,
+static ssize_t acpi_table_show(struct file *filp, struct kobject *kobj,
                               struct bin_attribute *bin_attr, char *buf,
                               loff_t offset, size_t count)
 {
@@ -102,6 +102,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
        struct acpi_table_header *header = NULL;
        struct acpi_table_attr *attr = NULL;
 
+       sysfs_attr_init(&table_attr->attr.attr);
        if (table_header->signature[0] != '\0')
                memcpy(table_attr->name, table_header->signature,
                        ACPI_NAME_SIZE);
@@ -124,7 +125,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
        table_attr->attr.size = 0;
        table_attr->attr.read = acpi_table_show;
        table_attr->attr.attr.name = table_attr->name;
-       table_attr->attr.attr.mode = 0444;
+       table_attr->attr.attr.mode = 0400;
 
        return;
 }
@@ -218,8 +219,9 @@ err:
 
 #define COUNT_GPE 0
 #define COUNT_SCI 1    /* acpi_irq_handled */
-#define COUNT_ERROR 2  /* other */
-#define NUM_COUNTERS_EXTRA 3
+#define COUNT_SCI_NOT 2        /* acpi_irq_not_handled */
+#define COUNT_ERROR 3  /* other */
+#define NUM_COUNTERS_EXTRA 4
 
 struct event_counter {
        u32 count;
@@ -301,8 +303,7 @@ static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle)
                                "Invalid GPE 0x%x\n", index));
                        goto end;
                }
-               result = acpi_get_gpe_status(*handle, index,
-                                               ACPI_NOT_ISR, status);
+               result = acpi_get_gpe_status(*handle, index, status);
        } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS))
                result = acpi_get_event_status(index - num_gpes, status);
 
@@ -321,6 +322,8 @@ static ssize_t counter_show(struct kobject *kobj,
 
        all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI].count =
                acpi_irq_handled;
+       all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT].count =
+               acpi_irq_not_handled;
        all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count =
                acpi_gpe_count;
 
@@ -367,6 +370,7 @@ static ssize_t counter_set(struct kobject *kobj,
                        all_counters[i].count = 0;
                acpi_gpe_count = 0;
                acpi_irq_handled = 0;
+               acpi_irq_not_handled = 0;
                goto end;
        }
 
@@ -384,13 +388,13 @@ static ssize_t counter_set(struct kobject *kobj,
        if (index < num_gpes) {
                if (!strcmp(buf, "disable\n") &&
                                (status & ACPI_EVENT_FLAG_ENABLED))
-                       result = acpi_disable_gpe(handle, index);
+                       result = acpi_set_gpe(handle, index, ACPI_GPE_DISABLE);
                else if (!strcmp(buf, "enable\n") &&
                                !(status & ACPI_EVENT_FLAG_ENABLED))
-                       result = acpi_enable_gpe(handle, index);
+                       result = acpi_set_gpe(handle, index, ACPI_GPE_ENABLE);
                else if (!strcmp(buf, "clear\n") &&
                                (status & ACPI_EVENT_FLAG_SET))
-                       result = acpi_clear_gpe(handle, index, ACPI_NOT_ISR);
+                       result = acpi_clear_gpe(handle, index);
                else
                        all_counters[index].count = strtoul(buf, NULL, 0);
        } else if (index < num_gpes + ACPI_NUM_FIXED_EVENTS) {
@@ -460,6 +464,8 @@ void acpi_irq_stats_init(void)
                        sprintf(buffer, "gpe_all");
                else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI)
                        sprintf(buffer, "sci");
+               else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT)
+                       sprintf(buffer, "sci_not");
                else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR)
                        sprintf(buffer, "error");
                else
@@ -470,6 +476,7 @@ void acpi_irq_stats_init(void)
                        goto fail;
                strncpy(name, buffer, strlen(buffer) + 1);
 
+               sysfs_attr_init(&counter_attrs[i].attr);
                counter_attrs[i].attr.name = name;
                counter_attrs[i].attr.mode = 0644;
                counter_attrs[i].show = counter_show;