diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/device_pm.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index e9e8bb24785b..4ab807dc8518 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) | |||
324 | if (result) | 324 | if (result) |
325 | return result; | 325 | return result; |
326 | 326 | ||
327 | if (state == ACPI_STATE_UNKNOWN) | 327 | if (state == ACPI_STATE_UNKNOWN) { |
328 | state = ACPI_STATE_D0; | 328 | state = ACPI_STATE_D0; |
329 | 329 | result = acpi_device_set_power(device, state); | |
330 | result = acpi_device_set_power(device, state); | 330 | if (result) |
331 | if (!result && state_p) | 331 | return result; |
332 | } else { | ||
333 | if (device->power.flags.power_resources) { | ||
334 | /* | ||
335 | * We don't need to really switch the state, bu we need | ||
336 | * to update the power resources' reference counters. | ||
337 | */ | ||
338 | result = acpi_power_transition(device, state); | ||
339 | if (result) | ||
340 | return result; | ||
341 | } | ||
342 | device->power.state = state; | ||
343 | } | ||
344 | if (state_p) | ||
332 | *state_p = state; | 345 | *state_p = state; |
333 | 346 | ||
334 | return result; | 347 | return 0; |
335 | } | 348 | } |
336 | EXPORT_SYMBOL_GPL(acpi_bus_update_power); | 349 | EXPORT_SYMBOL_GPL(acpi_bus_update_power); |
337 | 350 | ||