diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-12-12 22:51:58 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-12-12 22:51:58 +0100 |
commit | 175f8e2650f7ca6b33d338be3ccc1c00e89594ea (patch) | |
tree | 7a81830a3fd4a2da4db45d2dd791493a2ac6d5de /drivers/acpi/device_pm.c | |
parent | c52fa70c79acbb1d4868fee244a638d6ee6f5aab (diff) | |
download | linux-175f8e2650f7ca6b33d338be3ccc1c00e89594ea.tar.gz linux-175f8e2650f7ca6b33d338be3ccc1c00e89594ea.tar.bz2 linux-175f8e2650f7ca6b33d338be3ccc1c00e89594ea.zip |
ACPI / PM: Do not disable wakeup GPEs that have not been enabled
In some cases acpi_device_wakeup() may be called to ensure wakeup
power to be off for a given device even though that device's wakeup
GPE has not been enabled so far. It calls acpi_disable_gpe() on a
GPE that's not enabled and this causes ACPICA to return the AE_LIMIT
status code from that call which then is reported as an error by the
ACPICA's debug facilities (if enabled). This may lead to a fair
amount of confusion, so introduce a new ACPI device wakeup flag
to store the wakeup GPE status and avoid disabling wakeup GPEs
that have not been enabled.
Reported-and-tested-by: Venkat Raghavulu <venkat.raghavulu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/device_pm.c')
-rw-r--r-- | drivers/acpi/device_pm.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 076af8149566..e6ff33ecd784 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -680,13 +680,21 @@ static int acpi_device_wakeup(struct acpi_device *adev, u32 target_state, if (error) return error; + if (adev->wakeup.flags.enabled) + return 0; + res = acpi_enable_gpe(wakeup->gpe_device, wakeup->gpe_number); - if (ACPI_FAILURE(res)) { + if (ACPI_SUCCESS(res)) { + adev->wakeup.flags.enabled = 1; + } else { acpi_disable_wakeup_device_power(adev); return -EIO; } } else { - acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number); + if (adev->wakeup.flags.enabled) { + acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number); + adev->wakeup.flags.enabled = 0; + } acpi_disable_wakeup_device_power(adev); } return 0; |