提交 c19f9a84 编写于 作者: R Rafael J. Wysocki

ACPI / Button: Avoid disabling wakeup unnecessarily on remove

If a button device had already been enabled to wake up the system
from sleep states before the button driver saw it, the driver
shouldn't disable the device's wakeup capability when being detached
from the device.
Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
上级 51907267
......@@ -98,6 +98,7 @@ struct acpi_button {
struct input_dev *input;
char phys[32]; /* for input device */
unsigned long pushed;
bool wakeup_enabled;
};
static const struct file_operations acpi_button_info_fops = {
......@@ -430,7 +431,10 @@ static int acpi_button_add(struct acpi_device *device)
/* 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));
......@@ -452,6 +456,7 @@ static int acpi_button_remove(struct acpi_device *device, int type)
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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册