Commit b1028c54 authored by Konstantin Karasyov's avatar Konstantin Karasyov Committed by Len Brown
parent 724339d7
...@@ -199,15 +199,14 @@ int acpi_bus_set_power(acpi_handle handle, int state) ...@@ -199,15 +199,14 @@ int acpi_bus_set_power(acpi_handle handle, int state)
* Get device's current power state if it's unknown * Get device's current power state if it's unknown
* This means device power state isn't initialized or previous setting failed * This means device power state isn't initialized or previous setting failed
*/ */
if (!device->flags.force_power_state) { if ((device->power.state == ACPI_STATE_UNKNOWN) || device->flags.force_power_state)
if (device->power.state == ACPI_STATE_UNKNOWN)
acpi_bus_get_power(device->handle, &device->power.state); acpi_bus_get_power(device->handle, &device->power.state);
if (state == device->power.state) { if ((state == device->power.state) && !device->flags.force_power_state) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
state)); state));
return 0; return 0;
} }
}
if (!device->power.states[state].flags.valid) { if (!device->power.states[state].flags.valid) {
printk(KERN_WARNING PREFIX "Device does not support D%d\n", state); printk(KERN_WARNING PREFIX "Device does not support D%d\n", state);
return -ENODEV; return -ENODEV;
......
...@@ -412,6 +412,10 @@ int acpi_power_transition(struct acpi_device *device, int state) ...@@ -412,6 +412,10 @@ int acpi_power_transition(struct acpi_device *device, int state)
goto end; goto end;
} }
if (device->power.state == state) {
goto end;
}
/* /*
* Then we dereference all power resources used in the current list. * Then we dereference all power resources used in the current list.
*/ */
......
...@@ -1357,25 +1357,29 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) ...@@ -1357,25 +1357,29 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
static int acpi_thermal_resume(struct acpi_device *device) static int acpi_thermal_resume(struct acpi_device *device)
{ {
struct acpi_thermal *tz = NULL; struct acpi_thermal *tz = NULL;
int i; int i, j, power_state, result;
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return -EINVAL; return -EINVAL;
tz = acpi_driver_data(device); tz = acpi_driver_data(device);
acpi_thermal_get_temperature(tz);
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
if (tz->trips.active[i].flags.valid) { if (!(&tz->trips.active[i]))
tz->temperature = tz->trips.active[i].temperature; break;
if (!tz->trips.active[i].flags.valid)
break;
tz->trips.active[i].flags.enabled = 1;
for (j = 0; j < tz->trips.active[i].devices.count; j++) {
result = acpi_bus_get_power(tz->trips.active[i].devices.
handles[j], &power_state);
if (result || (power_state != ACPI_STATE_D0)) {
tz->trips.active[i].flags.enabled = 0; tz->trips.active[i].flags.enabled = 0;
break;
acpi_thermal_active(tz); }
tz->state.active |= tz->trips.active[i].flags.enabled;
tz->state.active_index = i;
} }
tz->state.active |= tz->trips.active[i].flags.enabled;
} }
acpi_thermal_check(tz); acpi_thermal_check(tz);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment