Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 197566
b: refs/heads/master
c: fc3155b
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Renninger authored and Matthew Garrett committed May 20, 2010
1 parent 974425b commit 3061961
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 9 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: 7ab52521f2d850e922f33e5586a47e6c83ec6f11
refs/heads/master: fc3155b2c6419a442c6f8b34a3bf31f8efe0fe33
58 changes: 50 additions & 8 deletions trunk/drivers/platform/x86/wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ static struct wmi_block wmi_blocks;
#define ACPI_WMI_STRING 0x4 /* GUID takes & returns a string */
#define ACPI_WMI_EVENT 0x8 /* GUID is an event */

static int debug_event;
module_param(debug_event, bool, 0444);
MODULE_PARM_DESC(debug_event,
"Log WMI Events [0/1]");

static int acpi_wmi_remove(struct acpi_device *device, int type);
static int acpi_wmi_add(struct acpi_device *device);
static void acpi_wmi_notify(struct acpi_device *device, u32 event);
Expand Down Expand Up @@ -477,6 +482,37 @@ const struct acpi_buffer *in)
}
EXPORT_SYMBOL_GPL(wmi_set_block);

static void wmi_notify_debug(u32 value, void *context)
{
struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *obj;

wmi_get_event_data(value, &response);

obj = (union acpi_object *)response.pointer;

if (!obj)
return;

printk(KERN_INFO PREFIX "DEBUG Event ");
switch(obj->type) {
case ACPI_TYPE_BUFFER:
printk("BUFFER_TYPE - length %d\n", obj->buffer.length);
break;
case ACPI_TYPE_STRING:
printk("STRING_TYPE - %s\n", obj->string.pointer);
break;
case ACPI_TYPE_INTEGER:
printk("INTEGER_TYPE - %llu\n", obj->integer.value);
break;
case ACPI_TYPE_PACKAGE:
printk("PACKAGE_TYPE - %d elements\n", obj->package.count);
break;
default:
printk("object type 0x%X\n", obj->type);
}
}

/**
* wmi_install_notify_handler - Register handler for WMI events
* @handler: Function to handle notifications
Expand All @@ -496,7 +532,7 @@ wmi_notify_handler handler, void *data)
if (!find_guid(guid, &block))
return AE_NOT_EXIST;

if (block->handler)
if (block->handler && block->handler != wmi_notify_debug)
return AE_ALREADY_ACQUIRED;

block->handler = handler;
Expand All @@ -516,22 +552,24 @@ EXPORT_SYMBOL_GPL(wmi_install_notify_handler);
acpi_status wmi_remove_notify_handler(const char *guid)
{
struct wmi_block *block;
acpi_status status;
acpi_status status = AE_OK;

if (!guid)
return AE_BAD_PARAMETER;

if (!find_guid(guid, &block))
return AE_NOT_EXIST;

if (!block->handler)
if (!block->handler || block->handler == wmi_notify_debug)
return AE_NULL_ENTRY;

status = wmi_method_enable(block, 0);

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

if (debug_event) {
block->handler = wmi_notify_debug;
} else {
status = wmi_method_enable(block, 0);
block->handler = NULL;
block->handler_data = NULL;
}
return status;
}
EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);
Expand Down Expand Up @@ -780,6 +818,10 @@ static __init acpi_status parse_wdg(acpi_handle handle)

wblock->gblock = gblock[i];
wblock->handle = handle;
if (debug_event) {
wblock->handler = wmi_notify_debug;
status = wmi_method_enable(wblock, 1);
}
list_add_tail(&wblock->list, &wmi_blocks.list);
}

Expand Down

0 comments on commit 3061961

Please sign in to comment.