Skip to content

Commit 024aa87

Browse files
committed
ACPI: PM: s2idle: Rework ACPI events synchronization
Note that the EC GPE processing need not be synchronized in acpi_s2idle_wake() after invoking acpi_ec_dispatch_gpe(), because that function checks the GPE status and dispatches its handler if need be and the SCI action handler is not going to run anyway at that point. Moreover, it is better to drain all of the pending ACPI events before restoring the working-state configuration of GPEs in acpi_s2idle_restore(), because those events are likely to be related to system wakeup, in which case they will not be relevant going forward. Rework the code to take these observations into account. Tested-by: Kenneth R. Crudup <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 016b87c commit 024aa87

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

drivers/acpi/sleep.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,16 @@ static int acpi_s2idle_prepare_late(void)
977977
return 0;
978978
}
979979

980+
static void acpi_s2idle_sync(void)
981+
{
982+
/*
983+
* The EC driver uses the system workqueue and an additional special
984+
* one, so those need to be flushed too.
985+
*/
986+
acpi_ec_flush_work();
987+
acpi_os_wait_events_complete(); /* synchronize Notify handling */
988+
}
989+
980990
static void acpi_s2idle_wake(void)
981991
{
982992
/*
@@ -1001,13 +1011,8 @@ static void acpi_s2idle_wake(void)
10011011
* should be missed by canceling the wakeup here.
10021012
*/
10031013
pm_system_cancel_wakeup();
1004-
/*
1005-
* The EC driver uses the system workqueue and an additional
1006-
* special one, so those need to be flushed too.
1007-
*/
1008-
acpi_os_wait_events_complete(); /* synchronize EC GPE processing */
1009-
acpi_ec_flush_work();
1010-
acpi_os_wait_events_complete(); /* synchronize Notify handling */
1014+
1015+
acpi_s2idle_sync();
10111016

10121017
rearm_wake_irq(acpi_sci_irq);
10131018
}
@@ -1024,6 +1029,13 @@ static void acpi_s2idle_restore_early(void)
10241029

10251030
static void acpi_s2idle_restore(void)
10261031
{
1032+
/*
1033+
* Drain pending events before restoring the working-state configuration
1034+
* of GPEs.
1035+
*/
1036+
acpi_os_wait_events_complete(); /* synchronize GPE processing */
1037+
acpi_s2idle_sync();
1038+
10271039
s2idle_wakeup = false;
10281040

10291041
acpi_enable_all_runtime_gpes();

0 commit comments

Comments
 (0)