public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI / PM: Make acpi_pm_device_sleep_state() follow the specification
@ 2012-05-25 22:04 Rafael J. Wysocki
  2012-05-26  1:54 ` Alan Stern
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2012-05-25 22:04 UTC (permalink / raw)
  To: Len Brown; +Cc: Linux PM list, ACPI Devel Mailing List, Lin Ming

From: Rafael J. Wysocki <rjw@sisk.pl>

The comparison between the system sleep state being entered
and the lowest system sleep state the given device may wake up
from in acpi_pm_device_sleep_state() is reversed, because the
specification (ACPI 5.0) says that for wakeup to work:

"The sleeping state being entered must be less than or equal to the
 power state declared in element 1 of the _PRW object."

Moreover, it also should check if the wakeup capability is supported
through ACPI, because in principle it may be done via native PCIe
PME, for example.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/acpi/sleep.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux/drivers/acpi/sleep.c
===================================================================
--- linux.orig/drivers/acpi/sleep.c
+++ linux/drivers/acpi/sleep.c
@@ -732,8 +732,8 @@ int acpi_pm_device_sleep_state(struct de
 	 * can wake the system.  _S0W may be valid, too.
 	 */
 	if (acpi_target_sleep_state == ACPI_STATE_S0 ||
-	    (device_may_wakeup(dev) &&
-	     adev->wakeup.sleep_state <= acpi_target_sleep_state)) {
+	    (device_may_wakeup(dev) && adev->wakeup.flags.valid &&
+	     adev->wakeup.sleep_state >= acpi_target_sleep_state)) {
 		acpi_status status;
 
 		acpi_method[3] = 'W';

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-26 20:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-25 22:04 [PATCH] ACPI / PM: Make acpi_pm_device_sleep_state() follow the specification Rafael J. Wysocki
2012-05-26  1:54 ` Alan Stern
2012-05-26 20:21   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox