diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 8e57fc49726ebafcd0bf6ba5c6043c649742c6e9..0e1441cc4d7fca8330178165727f8dfab0356618 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -200,7 +200,16 @@ static const char *state_string(int state) } } -static int __acpi_bus_get_power(struct acpi_device *device, int *state) +/** + * acpi_device_get_power - Get power state of an ACPI device. + * @device: Device to get the power state of. + * @state: Place to store the power state of the device. + * + * This function does not update the device's power.state field, but it may + * update its parent's power.state field (when the parent's power state is + * unknown and the device's power state turns out to be D0). + */ +int acpi_device_get_power(struct acpi_device *device, int *state) { int result = ACPI_STATE_UNKNOWN; @@ -397,7 +406,7 @@ int acpi_bus_init_power(struct acpi_device *device) device->power.state = ACPI_STATE_UNKNOWN; - result = __acpi_bus_get_power(device, &state); + result = acpi_device_get_power(device, &state); if (result) return result; @@ -421,7 +430,7 @@ int acpi_bus_update_power(acpi_handle handle, int *state_p) if (result) return result; - result = __acpi_bus_get_power(device, &state); + result = acpi_device_get_power(device, &state); if (result) return result; diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index a272c31569994131a5697426a5ce83ec31796b99..9d7c2ca0f1f75265b98924f4e2740797cb4115bc 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -331,6 +331,7 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle, unsigned long long *sta); int acpi_bus_get_status(struct acpi_device *device); int acpi_bus_set_power(acpi_handle handle, int state); +int acpi_device_get_power(struct acpi_device *device, int *state); int acpi_device_set_power(struct acpi_device *device, int state); int acpi_bus_update_power(acpi_handle handle, int *state_p); bool acpi_bus_power_manageable(acpi_handle handle);