diff mbox series

[3/8] ACPI: EC: Return bool from acpi_ec_dispatch_gpe()

Message ID 4778086.90p4OrCUAx@kreacher (mailing list archive)
State Mainlined, archived
Headers show
Series PM / ACPI: sleep: Simplify the suspend-to-idle control flow | expand

Commit Message

Rafael J. Wysocki July 16, 2019, 4:12 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

On some systems, if suspend-to-idle is used, the EC may singal system
wakeup events (power button events, for example) as well as events
that should not cause the system to resume and acpi_ec_dispatch_gpe()
needs to be called to determine whether or not the system should
resume then.  In particular, if acpi_ec_dispatch_gpe() doesn't detect
any EC events at all, the system should remain suspended, so it is
useful to know when that is the case.

For this reason, make acpi_ec_dispatch_gpe() return a bool value
indicating whether or not any EC events have been detected by it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/ec.c       |   11 ++++++++---
 drivers/acpi/internal.h |    2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

Comments

Pavel Machek July 21, 2019, 4:39 p.m. UTC | #1
On Tue 2019-07-16 18:12:59, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> On some systems, if suspend-to-idle is used, the EC may singal system

Typo "signal".

								Pavel
Rafael J. Wysocki July 22, 2019, 8:54 a.m. UTC | #2
On Sunday, July 21, 2019 6:39:29 PM CEST Pavel Machek wrote:
> On Tue 2019-07-16 18:12:59, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > 
> > On some systems, if suspend-to-idle is used, the EC may singal system
> 
> Typo "signal".

Thanks, fixed.
diff mbox series

Patch

Index: linux-pm/drivers/acpi/ec.c
===================================================================
--- linux-pm.orig/drivers/acpi/ec.c
+++ linux-pm/drivers/acpi/ec.c
@@ -1060,10 +1060,15 @@  void acpi_ec_set_gpe_wake_mask(u8 action
 		acpi_set_gpe_wake_mask(NULL, first_ec->gpe, action);
 }
 
-void acpi_ec_dispatch_gpe(void)
+bool acpi_ec_dispatch_gpe(void)
 {
-	if (first_ec)
-		acpi_dispatch_gpe(NULL, first_ec->gpe);
+	u32 ret;
+
+	if (!first_ec)
+		return false;
+
+	ret = acpi_dispatch_gpe(NULL, first_ec->gpe);
+	return ret == ACPI_INTERRUPT_HANDLED;
 }
 
 /* --------------------------------------------------------------------------
Index: linux-pm/drivers/acpi/internal.h
===================================================================
--- linux-pm.orig/drivers/acpi/internal.h
+++ linux-pm/drivers/acpi/internal.h
@@ -196,7 +196,7 @@  void acpi_ec_block_transactions(void);
 void acpi_ec_unblock_transactions(void);
 void acpi_ec_mark_gpe_for_wake(void);
 void acpi_ec_set_gpe_wake_mask(u8 action);
-void acpi_ec_dispatch_gpe(void);
+bool acpi_ec_dispatch_gpe(void);
 int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
 			      acpi_handle handle, acpi_ec_query_func func,
 			      void *data);