Skip to content

Commit

Permalink
ACPI / Button: Fix enabling button GPEs twice
Browse files Browse the repository at this point in the history
Button GPEs have been enabled in the acpi_wake_device_init() during
boot and the button driver enables them for the second time.
Consequently, it is necessary to do

# echo disable > /sys/firmware/acpi/interrupts/gpeXXX

twice in a row to disable those GPEs via sysfs. This patch is to
remove the GPE enabling code from the button driver to avoid the
problem.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Lan Tianyu authored and Rafael J. Wysocki committed Dec 19, 2013
1 parent 319e2e3 commit 8eaa29f
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions drivers/acpi/button.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ struct acpi_button {
struct input_dev *input;
char phys[32]; /* for input device */
unsigned long pushed;
bool wakeup_enabled;
};

static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier);
Expand Down Expand Up @@ -407,16 +406,6 @@ static int acpi_button_add(struct acpi_device *device)
lid_device = device;
}

if (device->wakeup.flags.valid) {
/* Button's GPE is run-wake GPE */
acpi_enable_gpe(device->wakeup.gpe_device,
device->wakeup.gpe_number);
if (!device_may_wakeup(&device->dev)) {
device_set_wakeup_enable(&device->dev, true);
button->wakeup_enabled = true;
}
}

printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device));
return 0;

Expand All @@ -433,13 +422,6 @@ static int acpi_button_remove(struct acpi_device *device)
{
struct acpi_button *button = acpi_driver_data(device);

if (device->wakeup.flags.valid) {
acpi_disable_gpe(device->wakeup.gpe_device,
device->wakeup.gpe_number);
if (button->wakeup_enabled)
device_set_wakeup_enable(&device->dev, false);
}

acpi_button_remove_fs(device);
input_unregister_device(button->input);
kfree(button);
Expand Down

0 comments on commit 8eaa29f

Please sign in to comment.