]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/acpi/button.c
ACPI: Use GPE reference counting to support shared GPEs
[net-next-2.6.git] / drivers / acpi / button.c
index 8a95e8329df732891b260efe67ad1c1855538be8..09ca3ce7a0513b0b5df978f0fba6194c7e8dc624 100644 (file)
@@ -422,11 +422,9 @@ static int acpi_button_add(struct acpi_device *device)
 
        if (device->wakeup.flags.valid) {
                /* Button's GPE is run-wake GPE */
-               acpi_set_gpe_type(device->wakeup.gpe_device,
-                                 device->wakeup.gpe_number,
-                                 ACPI_GPE_TYPE_WAKE_RUN);
                acpi_enable_gpe(device->wakeup.gpe_device,
-                               device->wakeup.gpe_number);
+                               device->wakeup.gpe_number,
+                               ACPI_GPE_TYPE_WAKE_RUN);
                device->wakeup.state.enabled = 1;
        }
 
@@ -446,6 +444,13 @@ static int acpi_button_remove(struct acpi_device *device, int type)
 {
        struct acpi_button *button = acpi_driver_data(device);
 
+       if (device->wakeup.flags.valid) {
+               acpi_disable_gpe(device->wakeup.gpe_device,
+                               device->wakeup.gpe_number,
+                               ACPI_GPE_TYPE_WAKE_RUN);
+               device->wakeup.state.enabled = 0;
+       }
+
        acpi_button_remove_fs(device);
        input_unregister_device(button->input);
        kfree(button);