aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-04-07 11:37:37 -0400
committerLen Brown <len.brown@intel.com>2009-04-07 16:26:58 -0400
commitf61bb93927fbc2933abe870813daba9d331aa121 (patch)
tree1abf5d936e9164b13145bd46edda0b1b83ca3a7c /drivers/platform
parent8037d6e67709cf497134bbabd77b07dfc7c31fd6 (diff)
ACPI: WMI: use .notify method instead of installing handler directly
This patch adds a .notify() method. The presence of .notify() causes Linux/ACPI to manage event handlers and notify handlers on our behalf, so we don't have to install and remove them ourselves. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> CC: Carlos Corbacho <carlos@strangeworlds.co.uk> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/wmi.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 2f269e117b8f..043b208d971d 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -81,6 +81,7 @@ static struct wmi_block wmi_blocks;
81 81
82static int acpi_wmi_remove(struct acpi_device *device, int type); 82static int acpi_wmi_remove(struct acpi_device *device, int type);
83static int acpi_wmi_add(struct acpi_device *device); 83static int acpi_wmi_add(struct acpi_device *device);
84static void acpi_wmi_notify(struct acpi_device *device, u32 event);
84 85
85static const struct acpi_device_id wmi_device_ids[] = { 86static const struct acpi_device_id wmi_device_ids[] = {
86 {"PNP0C14", 0}, 87 {"PNP0C14", 0},
@@ -96,6 +97,7 @@ static struct acpi_driver acpi_wmi_driver = {
96 .ops = { 97 .ops = {
97 .add = acpi_wmi_add, 98 .add = acpi_wmi_add,
98 .remove = acpi_wmi_remove, 99 .remove = acpi_wmi_remove,
100 .notify = acpi_wmi_notify,
99 }, 101 },
100}; 102};
101 103
@@ -643,12 +645,11 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address,
643 } 645 }
644} 646}
645 647
646static void acpi_wmi_notify(acpi_handle handle, u32 event, void *data) 648static void acpi_wmi_notify(struct acpi_device *device, u32 event)
647{ 649{
648 struct guid_block *block; 650 struct guid_block *block;
649 struct wmi_block *wblock; 651 struct wmi_block *wblock;
650 struct list_head *p; 652 struct list_head *p;
651 struct acpi_device *device = data;
652 653
653 list_for_each(p, &wmi_blocks.list) { 654 list_for_each(p, &wmi_blocks.list) {
654 wblock = list_entry(p, struct wmi_block, list); 655 wblock = list_entry(p, struct wmi_block, list);
@@ -669,9 +670,6 @@ static void acpi_wmi_notify(acpi_handle handle, u32 event, void *data)
669 670
670static int acpi_wmi_remove(struct acpi_device *device, int type) 671static int acpi_wmi_remove(struct acpi_device *device, int type)
671{ 672{
672 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
673 acpi_wmi_notify);
674
675 acpi_remove_address_space_handler(device->handle, 673 acpi_remove_address_space_handler(device->handle,
676 ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler); 674 ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler);
677 675
@@ -683,13 +681,6 @@ static int __init acpi_wmi_add(struct acpi_device *device)
683 acpi_status status; 681 acpi_status status;
684 int result = 0; 682 int result = 0;
685 683
686 status = acpi_install_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
687 acpi_wmi_notify, device);
688 if (ACPI_FAILURE(status)) {
689 printk(KERN_ERR PREFIX "Error installing notify handler\n");
690 return -ENODEV;
691 }
692
693 status = acpi_install_address_space_handler(device->handle, 684 status = acpi_install_address_space_handler(device->handle,
694 ACPI_ADR_SPACE_EC, 685 ACPI_ADR_SPACE_EC,
695 &acpi_wmi_ec_space_handler, 686 &acpi_wmi_ec_space_handler,