diff options
Diffstat (limited to 'drivers/acpi/device_pm.c')
-rw-r--r-- | drivers/acpi/device_pm.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index b3480cf7db1a..d49f1e464703 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
@@ -256,6 +256,8 @@ int acpi_bus_init_power(struct acpi_device *device) | |||
256 | return -EINVAL; | 256 | return -EINVAL; |
257 | 257 | ||
258 | device->power.state = ACPI_STATE_UNKNOWN; | 258 | device->power.state = ACPI_STATE_UNKNOWN; |
259 | if (!acpi_device_is_present(device)) | ||
260 | return 0; | ||
259 | 261 | ||
260 | result = acpi_device_get_power(device, &state); | 262 | result = acpi_device_get_power(device, &state); |
261 | if (result) | 263 | if (result) |
@@ -302,15 +304,18 @@ int acpi_device_fix_up_power(struct acpi_device *device) | |||
302 | return ret; | 304 | return ret; |
303 | } | 305 | } |
304 | 306 | ||
305 | int acpi_bus_update_power(acpi_handle handle, int *state_p) | 307 | int acpi_device_update_power(struct acpi_device *device, int *state_p) |
306 | { | 308 | { |
307 | struct acpi_device *device; | ||
308 | int state; | 309 | int state; |
309 | int result; | 310 | int result; |
310 | 311 | ||
311 | result = acpi_bus_get_device(handle, &device); | 312 | if (device->power.state == ACPI_STATE_UNKNOWN) { |
312 | if (result) | 313 | result = acpi_bus_init_power(device); |
314 | if (!result && state_p) | ||
315 | *state_p = device->power.state; | ||
316 | |||
313 | return result; | 317 | return result; |
318 | } | ||
314 | 319 | ||
315 | result = acpi_device_get_power(device, &state); | 320 | result = acpi_device_get_power(device, &state); |
316 | if (result) | 321 | if (result) |
@@ -338,6 +343,15 @@ int acpi_bus_update_power(acpi_handle handle, int *state_p) | |||
338 | 343 | ||
339 | return 0; | 344 | return 0; |
340 | } | 345 | } |
346 | |||
347 | int acpi_bus_update_power(acpi_handle handle, int *state_p) | ||
348 | { | ||
349 | struct acpi_device *device; | ||
350 | int result; | ||
351 | |||
352 | result = acpi_bus_get_device(handle, &device); | ||
353 | return result ? result : acpi_device_update_power(device, state_p); | ||
354 | } | ||
341 | EXPORT_SYMBOL_GPL(acpi_bus_update_power); | 355 | EXPORT_SYMBOL_GPL(acpi_bus_update_power); |
342 | 356 | ||
343 | bool acpi_bus_power_manageable(acpi_handle handle) | 357 | bool acpi_bus_power_manageable(acpi_handle handle) |