Commit c4302b5e47006d41c49ed10e66cea583658672e1

Authored by Rafael J. Wysocki
Committed by Greg Kroah-Hartman
1 parent 11ba6ba933

ACPI / PM: Do not disable wakeup GPEs that have not been enabled

commit 175f8e2650f7ca6b33d338be3ccc1c00e89594ea upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 2 changed files with 11 additions and 2 deletions Side-by-side Diff

drivers/acpi/device_pm.c
... ... @@ -680,13 +680,21 @@
680 680 if (error)
681 681 return error;
682 682  
  683 + if (adev->wakeup.flags.enabled)
  684 + return 0;
  685 +
683 686 res = acpi_enable_gpe(wakeup->gpe_device, wakeup->gpe_number);
684   - if (ACPI_FAILURE(res)) {
  687 + if (ACPI_SUCCESS(res)) {
  688 + adev->wakeup.flags.enabled = 1;
  689 + } else {
685 690 acpi_disable_wakeup_device_power(adev);
686 691 return -EIO;
687 692 }
688 693 } else {
689   - acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number);
  694 + if (adev->wakeup.flags.enabled) {
  695 + acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number);
  696 + adev->wakeup.flags.enabled = 0;
  697 + }
690 698 acpi_disable_wakeup_device_power(adev);
691 699 }
692 700 return 0;
include/acpi/acpi_bus.h
... ... @@ -312,6 +312,7 @@
312 312 u8 valid:1; /* Can successfully enable wakeup? */
313 313 u8 run_wake:1; /* Run-Wake GPE devices */
314 314 u8 notifier_present:1; /* Wake-up notify handler has been installed */
  315 + u8 enabled:1; /* Enabled for wakeup */
315 316 };
316 317  
317 318 struct acpi_device_wakeup_context {