]> xenbits.xen.org Git - xenclient/kernel.git/commitdiff
OEMs could optionally provide methods to enable/disable event data block. Call them...
authorKamala Narasimhan <kamala.narasimhan@citrix.com>
Mon, 23 Feb 2009 19:53:49 +0000 (14:53 -0500)
committerKamala Narasimhan <kamala.narasimhan@citrix.com>
Mon, 23 Feb 2009 19:53:49 +0000 (14:53 -0500)
This patch is based on an upstream patch but modified to fit our design.  Original patch signed off by -

Signed-off-by: Matthew Garrett <mj...@redhat.com>
Signed-off-by: Carlos Corbacho <car...@strangeworlds.co.uk>
drivers/acpi/wmi.c

index e468108c52ab814d90f17b6bc998155525768ceb..13d44881f9ddc99e1448ea5e06cb03ad95ee93dc 100644 (file)
@@ -112,6 +112,40 @@ static bool find_guid(const char *guid_string, struct wmi_block **out)
        return 0;
 }
 
+static acpi_status wmi_enable_event_data_blocks(int enable)
+{
+        struct list_head *p;
+        struct guid_block *gblock;
+        struct wmi_block *wblock;
+        char method[5];
+        struct acpi_object_list input;
+        union acpi_object params[1];
+        acpi_status status;
+
+        list_for_each(p, &wmi_blocks.list) {
+                wblock = list_entry(p, struct wmi_block, list);
+                gblock = &wblock->gblock;
+
+                if (gblock->flags & ACPI_WMI_EVENT) {
+                        input.count = 1;
+                        input.pointer = params;
+                        params[0].type = ACPI_TYPE_INTEGER;
+                        params[0].integer.value = enable;
+
+                        snprintf(method, 5, "WE%02X", gblock->notify_id);
+                        status = acpi_evaluate_object(wblock->handle, method, &input, NULL);
+
+                        if (status != AE_OK && status != AE_NOT_FOUND) {
+                                printk(KERN_INFO PREFIX "Event block %s enable failed\n", method);
+                                return status;
+                        } else 
+                                return AE_OK;
+                }
+        }
+
+        return AE_OK; /* if we don't have a wmi block (though odd), just return success */
+}
+
 /*
  * Exported WMI functions
  */
@@ -461,6 +495,7 @@ static int acpi_wmi_remove(struct acpi_device *device, int type)
        acpi_remove_address_space_handler(device->handle,
                                ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler);
 
+        wmi_enable_event_data_blocks(0);
        return 0;
 }
 
@@ -480,15 +515,21 @@ static int __init acpi_wmi_add(struct acpi_device *device)
                                                    ACPI_ADR_SPACE_EC,
                                                    &acpi_wmi_ec_space_handler,
                                                    NULL, NULL);
-       if (ACPI_FAILURE(status))
+       if (ACPI_FAILURE(status)) {
+                printk(KERN_ERR PREFIX "Error installing EC region handler\n");
                return -ENODEV;
+        }
 
        status = parse_wdg(device->handle);
        if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR PREFIX "Error installing EC region handler\n");
+               printk(KERN_ERR PREFIX "parse_wdg failed!\n");
                return -ENODEV;
        }
 
+        /* No need to check and fail if wmi_enable_event_data_blocks should fail.
+         * wmi_enable_event_data_blocks will print an error message.
+         */
+        wmi_enable_event_data_blocks(1);
        return result;
 }