ACPI / PM: Make acpi_pm_device_sleep_state() follow the specification
authorRafael J. Wysocki <rjw@sisk.pl>
Tue, 29 May 2012 19:21:07 +0000 (21:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Jul 2012 16:04:28 +0000 (09:04 -0700)
commit7c2c0261ce56126b72fbff0d67d9b1ac06f3c971
treeade640b61a5ced0a22442a81ff7d0b8243fada47
parent099fddaa7a49187a9405cb05c6373814884dfcff
ACPI / PM: Make acpi_pm_device_sleep_state() follow the specification

commit dbe9a2edd17d843d80faf2b99f20a691c1853418 upstream.

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."

In other words, the state returned by _PRW is the deepest
(lowest-power) system sleep state the device is capable of waking up
the system from.

Moreover, acpi_pm_device_sleep_state() also should check if the
wakeup capability is supported through ACPI, because in principle it
may be done via native PCIe PME, for example, in which case _SxW
should not be evaluated.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/sleep.c