linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Len Brown <len.brown@intel.com>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Rajneesh Bhardwaj <rajneesh.bhardwaj@linux.intel.com>,
	"David E. Box" <david.e.box@linux.intel.com>
Subject: [PATCH 5/8] ACPI: PM: Set s2idle_wakeup earlier and clear it later
Date: Tue, 16 Jul 2019 18:15:57 +0200	[thread overview]
Message-ID: <5118596.pkUOanpXUM@kreacher> (raw)
In-Reply-To: <71085220.z6FKkvYQPX@kreacher>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

The role of the s2idle_wakeup variable is to cause
acpi_pm_wakeup_event() and acpi_pm_notify_handler() to
increment pm_abort_suspend and trigger a wakeup from
suspend-to-idle in case the ACPI SCI wakeup was canceled
by acpi_s2idle_wake().

However, for this purpose it need not be set in acpi_s2idle_wake()
and cleared in acpi_s2idle_sync(), respectively.  In fact, it
may be set as early as in acpi_s2idle_prepare() and cleared as
late as in acpi_s2idle_restore(), so do that to allow subsequent
changes to be simpler.

This change is not expected to alter functionality.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/sleep.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: linux-pm/drivers/acpi/sleep.c
===================================================================
--- linux-pm.orig/drivers/acpi/sleep.c
+++ linux-pm/drivers/acpi/sleep.c
@@ -972,6 +972,8 @@ static int acpi_s2idle_prepare(void)
 	/* Change the configuration of GPEs to avoid spurious wakeup. */
 	acpi_enable_all_wakeup_gpes();
 	acpi_os_wait_events_complete();
+
+	s2idle_wakeup = true;
 	return 0;
 }
 
@@ -991,7 +993,6 @@ static void acpi_s2idle_wake(void)
 	if (acpi_sci_irq_valid() &&
 	    !irqd_is_wakeup_armed(irq_get_irq_data(acpi_sci_irq))) {
 		pm_system_cancel_wakeup();
-		s2idle_wakeup = true;
 		/*
 		 * On some platforms with the LPS0 _DSM device noirq resume
 		 * takes too much time for EC wakeup events to survive, so look
@@ -1012,11 +1013,12 @@ static void acpi_s2idle_sync(void)
 	acpi_os_wait_events_complete();	/* synchronize SCI IRQ handling */
 	acpi_ec_flush_work();
 	acpi_os_wait_events_complete();	/* synchronize Notify handling */
-	s2idle_wakeup = false;
 }
 
 static void acpi_s2idle_restore(void)
 {
+	s2idle_wakeup = false;
+
 	acpi_enable_all_runtime_gpes();
 
 	acpi_disable_wakeup_devices(ACPI_STATE_S0);




  parent reply	other threads:[~2019-07-16 16:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16 16:08 [PATCH 0/8] PM / ACPI: sleep: Simplify the suspend-to-idle control flow Rafael J. Wysocki
2019-07-16 16:10 ` [PATCH 1/8] PCI: irq: Introduce rearm_wake_irq() Rafael J. Wysocki
2019-07-16 16:11 ` [PATCH 2/8] ACPICA: Return u32 from acpi_dispatch_gpe() Rafael J. Wysocki
2019-07-16 16:12 ` [PATCH 3/8] ACPI: EC: Return bool from acpi_ec_dispatch_gpe() Rafael J. Wysocki
2019-07-16 16:14 ` [PATCH 4/8] PM: sleep: Fix possible overflow in pm_system_cancel_wakeup() Rafael J. Wysocki
2019-07-16 16:15 ` Rafael J. Wysocki [this message]
2019-07-16 16:17 ` [PATCH 6/8] PM: sleep: Simplify suspend-to-idle control flow Rafael J. Wysocki
2019-07-16 16:20 ` [PATCH 7/8] PM: sleep: Integrate suspend-to-idle with generig suspend flow Rafael J. Wysocki
2019-07-16 16:21 ` [PATCH 8/8] PM: sleep: Drop dpm_noirq_begin() and dpm_noirq_end() Rafael J. Wysocki
2019-07-22  9:46 ` [PATCH 0/8] PM / ACPI: sleep: Simplify the suspend-to-idle control flow Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5118596.pkUOanpXUM@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=david.e.box@linux.intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rajneesh.bhardwaj@linux.intel.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).