mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
PNP: make pnpacpi_suspend handle errors
pnpacpi_suspend() doesn't check the result returned by acpi_pm_device_sleep_state() before passing it to acpi_bus_set_power(), which may not be desirable. Make it select the target power state of the device using its second argument if acpi_pm_device_sleep_state() fails. Signed-off-by: Rafael J. Wysocki <[email protected]> Looks-ok-to: Pavel Machek <[email protected]> Cc: Adam Belay <[email protected]> Cc: Bjorn Helgaas <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
e8e961574b
commit
36e02b6208
1 changed files with 10 additions and 5 deletions
|
|
@ -130,11 +130,16 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
|
|||
#ifdef CONFIG_ACPI_SLEEP
|
||||
static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
|
||||
{
|
||||
return acpi_bus_set_power((acpi_handle) dev->data,
|
||||
acpi_pm_device_sleep_state(&dev->dev,
|
||||
device_may_wakeup
|
||||
(&dev->dev),
|
||||
NULL));
|
||||
int power_state;
|
||||
|
||||
power_state = acpi_pm_device_sleep_state(&dev->dev,
|
||||
device_may_wakeup(&dev->dev),
|
||||
NULL);
|
||||
if (power_state < 0)
|
||||
power_state = (state.event == PM_EVENT_ON) ?
|
||||
ACPI_STATE_D0 : ACPI_STATE_D3;
|
||||
|
||||
return acpi_bus_set_power((acpi_handle) dev->data, power_state);
|
||||
}
|
||||
|
||||
static int pnpacpi_resume(struct pnp_dev *dev)
|
||||
|
|
|
|||
Loading…
Reference in a new issue