diff options
| author | Len Brown <len.brown@intel.com> | 2009-12-30 02:51:01 -0500 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2009-12-30 02:51:01 -0500 |
| commit | 1ae22af7d750fbf665b7651fcbd3c15cc2d3793b (patch) | |
| tree | b1d7da8679c6730fdc98d531d544743f23d26c9f | |
| parent | 27d0567ab635bc2af11be48f91c8d5a7a2dca2e4 (diff) | |
| parent | d1f9e4970742bb1e22d07b01bd44f9c357d25c42 (diff) | |
Merge branch 'wmi' into release
| -rw-r--r-- | drivers/platform/x86/dell-wmi.c | 18 | ||||
| -rw-r--r-- | drivers/platform/x86/hp-wmi.c | 9 | ||||
| -rw-r--r-- | drivers/platform/x86/msi-wmi.c | 9 | ||||
| -rw-r--r-- | drivers/platform/x86/wmi.c | 36 |
4 files changed, 58 insertions, 14 deletions
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c index 916ccb2b316c..1b1dddbd5744 100644 --- a/drivers/platform/x86/dell-wmi.c +++ b/drivers/platform/x86/dell-wmi.c | |||
| @@ -202,8 +202,13 @@ static void dell_wmi_notify(u32 value, void *context) | |||
| 202 | struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; | 202 | struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; |
| 203 | static struct key_entry *key; | 203 | static struct key_entry *key; |
| 204 | union acpi_object *obj; | 204 | union acpi_object *obj; |
| 205 | acpi_status status; | ||
| 205 | 206 | ||
| 206 | wmi_get_event_data(value, &response); | 207 | status = wmi_get_event_data(value, &response); |
| 208 | if (status != AE_OK) { | ||
| 209 | printk(KERN_INFO "dell-wmi: bad event status 0x%x\n", status); | ||
| 210 | return; | ||
| 211 | } | ||
| 207 | 212 | ||
| 208 | obj = (union acpi_object *)response.pointer; | 213 | obj = (union acpi_object *)response.pointer; |
| 209 | 214 | ||
| @@ -323,8 +328,9 @@ static int __init dell_wmi_input_setup(void) | |||
| 323 | static int __init dell_wmi_init(void) | 328 | static int __init dell_wmi_init(void) |
| 324 | { | 329 | { |
| 325 | int err; | 330 | int err; |
| 331 | acpi_status status; | ||
| 326 | 332 | ||
| 327 | if (wmi_has_guid(DELL_EVENT_GUID)) { | 333 | if (!wmi_has_guid(DELL_EVENT_GUID)) { |
| 328 | printk(KERN_WARNING "dell-wmi: No known WMI GUID found\n"); | 334 | printk(KERN_WARNING "dell-wmi: No known WMI GUID found\n"); |
| 329 | return -ENODEV; | 335 | return -ENODEV; |
| 330 | } | 336 | } |
| @@ -336,14 +342,14 @@ static int __init dell_wmi_init(void) | |||
| 336 | if (err) | 342 | if (err) |
| 337 | return err; | 343 | return err; |
| 338 | 344 | ||
| 339 | err = wmi_install_notify_handler(DELL_EVENT_GUID, | 345 | status = wmi_install_notify_handler(DELL_EVENT_GUID, |
| 340 | dell_wmi_notify, NULL); | 346 | dell_wmi_notify, NULL); |
| 341 | if (err) { | 347 | if (ACPI_FAILURE(status)) { |
| 342 | input_unregister_device(dell_wmi_input_dev); | 348 | input_unregister_device(dell_wmi_input_dev); |
| 343 | printk(KERN_ERR | 349 | printk(KERN_ERR |
| 344 | "dell-wmi: Unable to register notify handler - %d\n", | 350 | "dell-wmi: Unable to register notify handler - %d\n", |
| 345 | err); | 351 | status); |
| 346 | return err; | 352 | return -ENODEV; |
| 347 | } | 353 | } |
| 348 | 354 | ||
| 349 | return 0; | 355 | return 0; |
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 8781d8fa7a57..5b648f0c6075 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
| @@ -338,8 +338,13 @@ static void hp_wmi_notify(u32 value, void *context) | |||
| 338 | static struct key_entry *key; | 338 | static struct key_entry *key; |
| 339 | union acpi_object *obj; | 339 | union acpi_object *obj; |
| 340 | int eventcode; | 340 | int eventcode; |
| 341 | acpi_status status; | ||
| 341 | 342 | ||
| 342 | wmi_get_event_data(value, &response); | 343 | status = wmi_get_event_data(value, &response); |
| 344 | if (status != AE_OK) { | ||
| 345 | printk(KERN_INFO "hp-wmi: bad event status 0x%x\n", status); | ||
| 346 | return; | ||
| 347 | } | ||
| 343 | 348 | ||
| 344 | obj = (union acpi_object *)response.pointer; | 349 | obj = (union acpi_object *)response.pointer; |
| 345 | 350 | ||
| @@ -581,7 +586,7 @@ static int __init hp_wmi_init(void) | |||
| 581 | if (wmi_has_guid(HPWMI_EVENT_GUID)) { | 586 | if (wmi_has_guid(HPWMI_EVENT_GUID)) { |
| 582 | err = wmi_install_notify_handler(HPWMI_EVENT_GUID, | 587 | err = wmi_install_notify_handler(HPWMI_EVENT_GUID, |
| 583 | hp_wmi_notify, NULL); | 588 | hp_wmi_notify, NULL); |
| 584 | if (!err) | 589 | if (ACPI_SUCCESS(err)) |
| 585 | hp_wmi_input_setup(); | 590 | hp_wmi_input_setup(); |
| 586 | } | 591 | } |
| 587 | 592 | ||
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c index 7f77f908bb01..f5f70d4c6913 100644 --- a/drivers/platform/x86/msi-wmi.c +++ b/drivers/platform/x86/msi-wmi.c | |||
| @@ -149,8 +149,13 @@ static void msi_wmi_notify(u32 value, void *context) | |||
| 149 | static struct key_entry *key; | 149 | static struct key_entry *key; |
| 150 | union acpi_object *obj; | 150 | union acpi_object *obj; |
| 151 | ktime_t cur; | 151 | ktime_t cur; |
| 152 | acpi_status status; | ||
| 152 | 153 | ||
| 153 | wmi_get_event_data(value, &response); | 154 | status = wmi_get_event_data(value, &response); |
| 155 | if (status != AE_OK) { | ||
| 156 | printk(KERN_INFO DRV_PFX "bad event status 0x%x\n", status); | ||
| 157 | return; | ||
| 158 | } | ||
| 154 | 159 | ||
| 155 | obj = (union acpi_object *)response.pointer; | 160 | obj = (union acpi_object *)response.pointer; |
| 156 | 161 | ||
| @@ -236,7 +241,7 @@ static int __init msi_wmi_init(void) | |||
| 236 | } | 241 | } |
| 237 | err = wmi_install_notify_handler(MSIWMI_EVENT_GUID, | 242 | err = wmi_install_notify_handler(MSIWMI_EVENT_GUID, |
| 238 | msi_wmi_notify, NULL); | 243 | msi_wmi_notify, NULL); |
| 239 | if (err) | 244 | if (ACPI_FAILURE(err)) |
| 240 | return -EINVAL; | 245 | return -EINVAL; |
| 241 | 246 | ||
| 242 | err = msi_wmi_input_setup(); | 247 | err = msi_wmi_input_setup(); |
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 9f93d6c0f510..b104302fea0a 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
| @@ -492,8 +492,7 @@ wmi_notify_handler handler, void *data) | |||
| 492 | if (!guid || !handler) | 492 | if (!guid || !handler) |
| 493 | return AE_BAD_PARAMETER; | 493 | return AE_BAD_PARAMETER; |
| 494 | 494 | ||
| 495 | find_guid(guid, &block); | 495 | if (!find_guid(guid, &block)) |
| 496 | if (!block) | ||
| 497 | return AE_NOT_EXIST; | 496 | return AE_NOT_EXIST; |
| 498 | 497 | ||
| 499 | if (block->handler) | 498 | if (block->handler) |
| @@ -521,8 +520,7 @@ acpi_status wmi_remove_notify_handler(const char *guid) | |||
| 521 | if (!guid) | 520 | if (!guid) |
| 522 | return AE_BAD_PARAMETER; | 521 | return AE_BAD_PARAMETER; |
| 523 | 522 | ||
| 524 | find_guid(guid, &block); | 523 | if (!find_guid(guid, &block)) |
| 525 | if (!block) | ||
| 526 | return AE_NOT_EXIST; | 524 | return AE_NOT_EXIST; |
| 527 | 525 | ||
| 528 | if (!block->handler) | 526 | if (!block->handler) |
| @@ -716,6 +714,22 @@ static int wmi_class_init(void) | |||
| 716 | return ret; | 714 | return ret; |
| 717 | } | 715 | } |
| 718 | 716 | ||
| 717 | static bool guid_already_parsed(const char *guid_string) | ||
| 718 | { | ||
| 719 | struct guid_block *gblock; | ||
| 720 | struct wmi_block *wblock; | ||
| 721 | struct list_head *p; | ||
| 722 | |||
| 723 | list_for_each(p, &wmi_blocks.list) { | ||
| 724 | wblock = list_entry(p, struct wmi_block, list); | ||
| 725 | gblock = &wblock->gblock; | ||
| 726 | |||
| 727 | if (strncmp(gblock->guid, guid_string, 16) == 0) | ||
| 728 | return true; | ||
| 729 | } | ||
| 730 | return false; | ||
| 731 | } | ||
| 732 | |||
| 719 | /* | 733 | /* |
| 720 | * Parse the _WDG method for the GUID data blocks | 734 | * Parse the _WDG method for the GUID data blocks |
| 721 | */ | 735 | */ |
| @@ -725,6 +739,7 @@ static __init acpi_status parse_wdg(acpi_handle handle) | |||
| 725 | union acpi_object *obj; | 739 | union acpi_object *obj; |
| 726 | struct guid_block *gblock; | 740 | struct guid_block *gblock; |
| 727 | struct wmi_block *wblock; | 741 | struct wmi_block *wblock; |
| 742 | char guid_string[37]; | ||
| 728 | acpi_status status; | 743 | acpi_status status; |
| 729 | u32 i, total; | 744 | u32 i, total; |
| 730 | 745 | ||
| @@ -747,6 +762,19 @@ static __init acpi_status parse_wdg(acpi_handle handle) | |||
| 747 | memcpy(gblock, obj->buffer.pointer, obj->buffer.length); | 762 | memcpy(gblock, obj->buffer.pointer, obj->buffer.length); |
| 748 | 763 | ||
| 749 | for (i = 0; i < total; i++) { | 764 | for (i = 0; i < total; i++) { |
| 765 | /* | ||
| 766 | Some WMI devices, like those for nVidia hooks, have a | ||
| 767 | duplicate GUID. It's not clear what we should do in this | ||
| 768 | case yet, so for now, we'll just ignore the duplicate. | ||
| 769 | Anyone who wants to add support for that device can come | ||
| 770 | up with a better workaround for the mess then. | ||
| 771 | */ | ||
| 772 | if (guid_already_parsed(gblock[i].guid) == true) { | ||
| 773 | wmi_gtoa(gblock[i].guid, guid_string); | ||
| 774 | printk(KERN_INFO PREFIX "Skipping duplicate GUID %s\n", | ||
| 775 | guid_string); | ||
| 776 | continue; | ||
| 777 | } | ||
| 750 | wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL); | 778 | wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL); |
| 751 | if (!wblock) | 779 | if (!wblock) |
| 752 | return AE_NO_MEMORY; | 780 | return AE_NO_MEMORY; |
