@@ -337,8 +337,22 @@ int acpi_bus_init_power(struct acpi_device *device)
if (result)
return result;
- if (device->power.flags.power_resources)
+ if (device->power.flags.power_resources) {
result = acpi_power_on_resources(device, state);
+ if (result)
+ return result;
+ }
+
+ /* if state is valid and _PSx exists, execute it */
+ if (state >= ACPI_STATE_D0 && state <= ACPI_STATE_D3 &&
+ device->power.states[state].flags.explicit_set) {
+ acpi_status status;
+ char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' };
+ status = acpi_evaluate_object(device->handle, object_name,
+ NULL, NULL);
+ if (ACPI_FAILURE(status))
+ result = -ENODEV;
+ }
if (!result)
device->power.state = state;