public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: Linux PM <linux-pm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Linux PCI <linux-pci@vger.kernel.org>
Subject: [PATCH v1 3/3] ACPI: PM: Turn off wakeup power resources on _DSW/_PSW errors
Date: Fri, 15 Oct 2021 19:04:26 +0200	[thread overview]
Message-ID: <2795050.e9J7NaK4W3@kreacher> (raw)
In-Reply-To: <4347933.LvFx2qVVIh@kreacher>

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

If acpi_device_sleep_wake() called by acpi_enable_wakeup_device_power()
returns an error which means that the evaluation of either _DWS or
_PSW has failed, turn off all of the device's wakeup power resources
to be consistent with the clearing of dev->wakeup.prepare_count.

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

Index: linux-pm/drivers/acpi/power.c
===================================================================
--- linux-pm.orig/drivers/acpi/power.c
+++ linux-pm/drivers/acpi/power.c
@@ -731,8 +731,10 @@ int acpi_enable_wakeup_device_power(stru
 	 * put into arbitrary power state afterward.
 	 */
 	err = acpi_device_sleep_wake(dev, 1, sleep_state, 3);
-	if (err)
+	if (err) {
+		acpi_power_off_list(&dev->wakeup.resources);
 		dev->wakeup.prepare_count = 0;
+	}
 
  out:
 	mutex_unlock(&acpi_device_lock);




      parent reply	other threads:[~2021-10-15 17:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15 16:59 [PATCH v1 0/3] ACPI: PM: Address issues related to managing wakeup power resources Rafael J. Wysocki
2021-10-15 17:01 ` [PATCH v1 1/3] ACPI: PM: Turn off unused " Rafael J. Wysocki
2021-10-15 17:03 ` [PATCH v1 2/3] ACPI: PM: Fix sharing of " Rafael J. Wysocki
2021-10-15 20:31   ` kernel test robot
2021-10-16 10:11   ` [PATCH v2 " Rafael J. Wysocki
2021-10-19  7:25   ` [PATCH v1 " kernel test robot
2021-10-15 17:04 ` Rafael J. Wysocki [this message]

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=2795050.e9J7NaK4W3@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /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