summaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/device_pm.c46
1 files changed, 17 insertions, 29 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index d7f3908c2e88..2ce07cee0434 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -242,50 +242,38 @@ int acpi_device_set_power(struct acpi_device *device, int state)
cut_power = true;
}
+ if (state < device->power.state && state != ACPI_STATE_D0
+ && device->power.state >= ACPI_STATE_D3_HOT) {
+ printk(KERN_WARNING PREFIX
+ "Cannot transition to non-D0 state from D3\n");
+ return -ENODEV;
+ }
+
/*
* Transition Power
* ----------------
- * On transitions to a high-powered state we first apply power (via
- * power resources) then evalute _PSx. Conversly for transitions to
- * a lower-powered state.
+ * In accordance with the ACPI specification first apply power (via
+ * power resources) and then evalute _PSx.
*/
- if (state < device->power.state) {
- if (device->power.state >= ACPI_STATE_D3_HOT &&
- state != ACPI_STATE_D0) {
- printk(KERN_WARNING PREFIX
- "Cannot transition to non-D0 state from D3\n");
- return -ENODEV;
- }
- if (device->power.flags.power_resources) {
- result = acpi_power_transition(device, state);
- if (result)
- goto end;
- }
- result = acpi_dev_pm_explicit_set(device, state);
+ if (device->power.flags.power_resources) {
+ result = acpi_power_transition(device, state);
if (result)
goto end;
- } else {
- result = acpi_dev_pm_explicit_set(device, state);
- if (result)
- goto end;
-
- if (device->power.flags.power_resources) {
- result = acpi_power_transition(device, state);
- if (result)
- goto end;
- }
}
+ result = acpi_dev_pm_explicit_set(device, state);
+ if (result)
+ goto end;
if (cut_power)
result = acpi_power_transition(device, ACPI_STATE_D3_COLD);
- end:
- if (result)
+ end:
+ if (result) {
printk(KERN_WARNING PREFIX
"Device [%s] failed to transition to %s\n",
device->pnp.bus_id,
acpi_power_state_string(state));
- else {
+ } else {
device->power.state = state;
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Device [%s] transitioned to %s\n",