Skip to content

Commit 48e4130

Browse files
rafaeljwgregkh
authored andcommitted
ACPI: PM: s2idle: Cancel wakeup before dispatching EC GPE
[ Upstream commit dc0075b ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3b72d3f commit 48e4130

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
@@ -2064,6 +2064,16 @@ bool acpi_ec_dispatch_gpe(void)
20642064
if (acpi_any_gpe_status_set(first_ec->gpe))
20652065
return true;
20662066

2067+
/*
2068+
* Cancel the SCI wakeup and process all pending events in case there
2069+
* are any wakeup ones in there.
2070+
*
2071+
* Note that if any non-EC GPEs are active at this point, the SCI will
2072+
* retrigger after the rearming in acpi_s2idle_wake(), so no events
2073+
* should be missed by canceling the wakeup here.
2074+
*/
2075+
pm_system_cancel_wakeup();
2076+
20672077
/*
20682078
* Dispatch the EC GPE in-band, but do not report wakeup in any case
20692079
* 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
@@ -1012,21 +1012,15 @@ static bool acpi_s2idle_wake(void)
10121012
return true;
10131013
}
10141014

1015-
/* Check non-EC GPE wakeups and dispatch the EC GPE. */
1015+
/*
1016+
* Check non-EC GPE wakeups and if there are none, cancel the
1017+
* SCI-related wakeup and dispatch the EC GPE.
1018+
*/
10161019
if (acpi_ec_dispatch_gpe()) {
10171020
pm_pr_dbg("ACPI non-EC GPE wakeup\n");
10181021
return true;
10191022
}
10201023

1021-
/*
1022-
* Cancel the SCI wakeup and process all pending events in case
1023-
* there are any wakeup ones in there.
1024-
*
1025-
* Note that if any non-EC GPEs are active at this point, the
1026-
* SCI will retrigger after the rearming below, so no events
1027-
* should be missed by canceling the wakeup here.
1028-
*/
1029-
pm_system_cancel_wakeup();
10301024
acpi_os_wait_events_complete();
10311025

10321026
/*

0 commit comments

Comments
 (0)