diff options
author | Lv Zheng <lv.zheng@intel.com> | 2012-11-15 20:46:28 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-15 20:46:28 -0500 |
commit | ddc150f7a33ae0c9cb16eaac3641abc00f56316f (patch) | |
tree | d1b2cdfee5e7055e1dfa18d4fbb3dc16f22576ee | |
parent | 5133375bb46a0d6c3fba07097caed7aa5e629ccd (diff) |
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>
-rw-r--r-- | drivers/acpi/bus.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 07a20ee3e690..1f0d457ecbcf 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -306,6 +306,12 @@ int acpi_device_set_power(struct acpi_device *device, int state) | |||
306 | * a lower-powered state. | 306 | * a lower-powered state. |
307 | */ | 307 | */ |
308 | if (state < device->power.state) { | 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 | if (device->power.flags.power_resources) { | 315 | if (device->power.flags.power_resources) { |
310 | result = acpi_power_transition(device, state); | 316 | result = acpi_power_transition(device, state); |
311 | if (result) | 317 | if (result) |