Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350933
b: refs/heads/master
c: e78adb7
h: refs/heads/master
i:
  350931: 6171ea8
v: v3
  • Loading branch information
Rafael J. Wysocki committed Jan 22, 2013
1 parent 8f1bb0d commit f43afc9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9c0f45e388fb9f9003ea22f98b84ffbab65ba554
refs/heads/master: e78adb7595a9d585c60a7497345cb6eaeaaacefb
46 changes: 17 additions & 29 deletions trunk/drivers/acpi/device_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f43afc9

Please sign in to comment.