aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi/device_pm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-07-22 11:16:51 +0100
committerMark Brown <broonie@linaro.org>2013-07-22 11:16:51 +0100
commit9f6772da061814c2962aeb7d79231f7510dba313 (patch)
treee0c4a856204af6adff125ee61fe1f3059cada71b /drivers/acpi/device_pm.c
parentd998ec4860d366424a55059093bb022beb38a61d (diff)
parent0f4a56e16d5fc9028b62ba529177a3109513e111 (diff)
Merge tag 'v3.10.2' into linux-linaro-lsk-androidlsk-android
This is the 3.10.2 stable release
Diffstat (limited to 'drivers/acpi/device_pm.c')
-rw-r--r--drivers/acpi/device_pm.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index 31c217a4283..553527c2532 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -324,14 +324,27 @@ int acpi_bus_update_power(acpi_handle handle, int *state_p)
if (result)
return result;
- if (state == ACPI_STATE_UNKNOWN)
+ if (state == ACPI_STATE_UNKNOWN) {
state = ACPI_STATE_D0;
-
- result = acpi_device_set_power(device, state);
- if (!result && state_p)
+ result = acpi_device_set_power(device, state);
+ if (result)
+ return result;
+ } else {
+ if (device->power.flags.power_resources) {
+ /*
+ * We don't need to really switch the state, bu we need
+ * to update the power resources' reference counters.
+ */
+ result = acpi_power_transition(device, state);
+ if (result)
+ return result;
+ }
+ device->power.state = state;
+ }
+ if (state_p)
*state_p = state;
- return result;
+ return 0;
}
EXPORT_SYMBOL_GPL(acpi_bus_update_power);