Commit 2cebc5e2 authored by Len Brown's avatar Len Brown

Merge branch 'bugzilla-15951' into release

parents c1db9d9b cb1cb178
...@@ -425,7 +425,7 @@ static int acpi_button_add(struct acpi_device *device) ...@@ -425,7 +425,7 @@ static int acpi_button_add(struct acpi_device *device)
/* Button's GPE is run-wake GPE */ /* Button's GPE is run-wake GPE */
acpi_enable_gpe(device->wakeup.gpe_device, acpi_enable_gpe(device->wakeup.gpe_device,
device->wakeup.gpe_number, device->wakeup.gpe_number,
ACPI_GPE_TYPE_WAKE_RUN); ACPI_GPE_TYPE_RUNTIME);
device->wakeup.run_wake_count++; device->wakeup.run_wake_count++;
device->wakeup.state.enabled = 1; device->wakeup.state.enabled = 1;
} }
...@@ -449,7 +449,7 @@ static int acpi_button_remove(struct acpi_device *device, int type) ...@@ -449,7 +449,7 @@ static int acpi_button_remove(struct acpi_device *device, int type)
if (device->wakeup.flags.valid) { if (device->wakeup.flags.valid) {
acpi_disable_gpe(device->wakeup.gpe_device, acpi_disable_gpe(device->wakeup.gpe_device,
device->wakeup.gpe_number, device->wakeup.gpe_number,
ACPI_GPE_TYPE_WAKE_RUN); ACPI_GPE_TYPE_RUNTIME);
device->wakeup.run_wake_count--; device->wakeup.run_wake_count--;
device->wakeup.state.enabled = 0; device->wakeup.state.enabled = 0;
} }
......
...@@ -64,16 +64,13 @@ void acpi_enable_wakeup_device(u8 sleep_state) ...@@ -64,16 +64,13 @@ void acpi_enable_wakeup_device(u8 sleep_state)
struct acpi_device *dev = struct acpi_device *dev =
container_of(node, struct acpi_device, wakeup_list); container_of(node, struct acpi_device, wakeup_list);
if (!dev->wakeup.flags.valid) if (!dev->wakeup.flags.valid || !dev->wakeup.state.enabled
continue;
if ((!dev->wakeup.state.enabled && !dev->wakeup.prepare_count)
|| sleep_state > (u32) dev->wakeup.sleep_state) || sleep_state > (u32) dev->wakeup.sleep_state)
continue; continue;
/* The wake-up power should have been enabled already. */ /* The wake-up power should have been enabled already. */
acpi_set_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
ACPI_GPE_ENABLE); ACPI_GPE_TYPE_WAKE);
} }
} }
...@@ -96,6 +93,8 @@ void acpi_disable_wakeup_device(u8 sleep_state) ...@@ -96,6 +93,8 @@ void acpi_disable_wakeup_device(u8 sleep_state)
|| (sleep_state > (u32) dev->wakeup.sleep_state)) || (sleep_state > (u32) dev->wakeup.sleep_state))
continue; continue;
acpi_disable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
ACPI_GPE_TYPE_WAKE);
acpi_disable_wakeup_device_power(dev); acpi_disable_wakeup_device_power(dev);
} }
} }
...@@ -109,12 +108,7 @@ int __init acpi_wakeup_device_init(void) ...@@ -109,12 +108,7 @@ int __init acpi_wakeup_device_init(void)
struct acpi_device *dev = container_of(node, struct acpi_device *dev = container_of(node,
struct acpi_device, struct acpi_device,
wakeup_list); wakeup_list);
/* In case user doesn't load button driver */ if (dev->wakeup.flags.always_enabled)
if (!dev->wakeup.flags.always_enabled ||
dev->wakeup.state.enabled)
continue;
acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
ACPI_GPE_TYPE_WAKE);
dev->wakeup.state.enabled = 1; dev->wakeup.state.enabled = 1;
} }
mutex_unlock(&acpi_device_lock); mutex_unlock(&acpi_device_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment