Commit 880a6627 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

ACPI / PM / EC: Flush all EC work in acpi_freeze_sync()

Commit eed4d47e (ACPI / sleep: Ignore spurious SCI wakeups from
suspend-to-idle) introduced acpi_freeze_sync() whose purpose is to
flush all of the processing of possible wakeup events signaled via
the ACPI SCI.  However, it doesn't flush the query workqueue used
by the EC driver, so the events generated by the EC may not be
processed timely which leads to issues (increased overhead at least,
lost events possibly).

To fix that introduce acpi_ec_flush_work() that will flush all of
the outstanding EC work and call it from acpi_freeze_sync().

Fixes: eed4d47e (ACPI / sleep: Ignore spurious SCI wakeups from suspend-to-idle)
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 6ed86005
...@@ -539,6 +539,14 @@ static void acpi_ec_disable_event(struct acpi_ec *ec) ...@@ -539,6 +539,14 @@ static void acpi_ec_disable_event(struct acpi_ec *ec)
spin_unlock_irqrestore(&ec->lock, flags); spin_unlock_irqrestore(&ec->lock, flags);
__acpi_ec_flush_event(ec); __acpi_ec_flush_event(ec);
} }
void acpi_ec_flush_work(void)
{
if (first_ec)
__acpi_ec_flush_event(first_ec);
flush_scheduled_work();
}
#endif /* CONFIG_PM_SLEEP */ #endif /* CONFIG_PM_SLEEP */
static bool acpi_ec_guard_event(struct acpi_ec *ec) static bool acpi_ec_guard_event(struct acpi_ec *ec)
......
...@@ -193,6 +193,10 @@ int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit, ...@@ -193,6 +193,10 @@ int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
void *data); void *data);
void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit); void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit);
#ifdef CONFIG_PM_SLEEP
void acpi_ec_flush_work(void);
#endif
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
Suspend/Resume Suspend/Resume
......
...@@ -777,11 +777,11 @@ static void acpi_freeze_sync(void) ...@@ -777,11 +777,11 @@ static void acpi_freeze_sync(void)
/* /*
* Process all pending events in case there are any wakeup ones. * Process all pending events in case there are any wakeup ones.
* *
* The EC driver uses the system workqueue, so that one needs to be * The EC driver uses the system workqueue and an additional special
* flushed too. * one, so those need to be flushed too.
*/ */
acpi_ec_flush_work();
acpi_os_wait_events_complete(); acpi_os_wait_events_complete();
flush_scheduled_work();
s2idle_wakeup = false; s2idle_wakeup = false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment