Commit ddc150f7a33ae0c9cb16eaac3641abc00f56316f

Authored by Lv Zheng
Committed by Rafael J. Wysocki
1 parent 5133375bb4

ACPI / PM: Add check preventing transitioning to non-D0 state from D3.

No power transitioning from D3 state up to a non-D0 state is allowed
so make acpi_device_set_power() fail and complain if such a transition
is attempted.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Showing 1 changed file with 6 additions and 0 deletions Side-by-side Diff

... ... @@ -306,6 +306,12 @@
306 306 * a lower-powered state.
307 307 */
308 308 if (state < device->power.state) {
  309 + if (device->power.state >= ACPI_STATE_D3_HOT &&
  310 + state != ACPI_STATE_D0) {
  311 + printk(KERN_WARNING PREFIX
  312 + "Cannot transition to non-D0 state from D3\n");
  313 + return -ENODEV;
  314 + }
309 315 if (device->power.flags.power_resources) {
310 316 result = acpi_power_transition(device, state);
311 317 if (result)