Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117276
b: refs/heads/master
c: a66bfa7
h: refs/heads/master
v: v3
  • Loading branch information
Matthew Garrett authored and Len Brown committed Oct 8, 2008
1 parent 9c0f73a commit 33f738d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7d9a06de616f69374dab00396f27cf00962a72c9
refs/heads/master: a66bfa7a4726e9cbdc985133af728a4bd9925d96
39 changes: 37 additions & 2 deletions trunk/drivers/acpi/wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,35 @@ static bool find_guid(const char *guid_string, struct wmi_block **out)
return 0;
}

static acpi_status wmi_method_enable(struct wmi_block *wblock, int enable)
{
struct guid_block *block = NULL;
char method[5];
struct acpi_object_list input;
union acpi_object params[1];
acpi_status status;
acpi_handle handle;

block = &wblock->gblock;
handle = wblock->handle;

if (!block)
return AE_NOT_EXIST;

input.count = 1;
input.pointer = params;
params[0].type = ACPI_TYPE_INTEGER;
params[0].integer.value = enable;

snprintf(method, 5, "WE%02X", block->notify_id);
status = acpi_evaluate_object(handle, method, &input, NULL);

if (status != AE_OK && status != AE_NOT_FOUND)
return status;
else
return AE_OK;
}

/*
* Exported WMI functions
*/
Expand Down Expand Up @@ -427,6 +456,7 @@ acpi_status wmi_install_notify_handler(const char *guid,
wmi_notify_handler handler, void *data)
{
struct wmi_block *block;
acpi_status status;

if (!guid || !handler)
return AE_BAD_PARAMETER;
Expand All @@ -441,7 +471,9 @@ wmi_notify_handler handler, void *data)
block->handler = handler;
block->handler_data = data;

return AE_OK;
status = wmi_method_enable(block, 1);

return status;
}
EXPORT_SYMBOL_GPL(wmi_install_notify_handler);

Expand All @@ -453,6 +485,7 @@ EXPORT_SYMBOL_GPL(wmi_install_notify_handler);
acpi_status wmi_remove_notify_handler(const char *guid)
{
struct wmi_block *block;
acpi_status status;

if (!guid)
return AE_BAD_PARAMETER;
Expand All @@ -464,10 +497,12 @@ acpi_status wmi_remove_notify_handler(const char *guid)
if (!block->handler)
return AE_NULL_ENTRY;

status = wmi_method_enable(block, 0);

block->handler = NULL;
block->handler_data = NULL;

return AE_OK;
return status;
}
EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);

Expand Down

0 comments on commit 33f738d

Please sign in to comment.