Skip to content

Commit dc0075b

Browse files
committed
ACPI: PM: s2idle: Cancel wakeup before dispatching EC GPE
Commit 4a9af6c ("ACPI: EC: Rework flushing of EC work while suspended to idle") made acpi_ec_dispatch_gpe() check pm_wakeup_pending(), but that is before canceling the SCI wakeup, so pm_wakeup_pending() is always true. This causes the loop in acpi_ec_dispatch_gpe() to always terminate after one iteration which may not be correct. Address this issue by canceling the SCI wakeup earlier, from acpi_ec_dispatch_gpe() itself. Fixes: 4a9af6c ("ACPI: EC: Rework flushing of EC work while suspended to idle") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent d6ebb17 commit dc0075b

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

drivers/acpi/ec.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,6 +2065,16 @@ bool acpi_ec_dispatch_gpe(void)
20652065
if (acpi_any_gpe_status_set(first_ec->gpe))
20662066
return true;
20672067

2068+
/*
2069+
* Cancel the SCI wakeup and process all pending events in case there
2070+
* are any wakeup ones in there.
2071+
*
2072+
* Note that if any non-EC GPEs are active at this point, the SCI will
2073+
* retrigger after the rearming in acpi_s2idle_wake(), so no events
2074+
* should be missed by canceling the wakeup here.
2075+
*/
2076+
pm_system_cancel_wakeup();
2077+
20682078
/*
20692079
* Dispatch the EC GPE in-band, but do not report wakeup in any case
20702080
* to allow the caller to process events properly after that.

drivers/acpi/sleep.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -736,21 +736,15 @@ bool acpi_s2idle_wake(void)
736736
return true;
737737
}
738738

739-
/* Check non-EC GPE wakeups and dispatch the EC GPE. */
739+
/*
740+
* Check non-EC GPE wakeups and if there are none, cancel the
741+
* SCI-related wakeup and dispatch the EC GPE.
742+
*/
740743
if (acpi_ec_dispatch_gpe()) {
741744
pm_pr_dbg("ACPI non-EC GPE wakeup\n");
742745
return true;
743746
}
744747

745-
/*
746-
* Cancel the SCI wakeup and process all pending events in case
747-
* there are any wakeup ones in there.
748-
*
749-
* Note that if any non-EC GPEs are active at this point, the
750-
* SCI will retrigger after the rearming below, so no events
751-
* should be missed by canceling the wakeup here.
752-
*/
753-
pm_system_cancel_wakeup();
754748
acpi_os_wait_events_complete();
755749

756750
/*

0 commit comments

Comments
 (0)