summaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2007-02-16 22:11:50 -0500
committerLen Brown <len.brown@intel.com>2007-02-16 22:11:50 -0500
commit08e4a10ec82faf5ba67c8d0115b7bc9e58071555 (patch)
treebe31751f933ea26d8e7edb592a19584c3ff50679 /drivers/acpi
parent4559b438225b01942e1661759db0df55883b1bc0 (diff)
parentb1028c545ced13590dd9a9a8086543aef26c7187 (diff)
Pull bugzilla-7570 into release branch
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/bus.c15
-rw-r--r--drivers/acpi/power.c4
-rw-r--r--drivers/acpi/thermal.c28
3 files changed, 27 insertions, 20 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index fd37e19360d..0c93cd400dd 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -199,15 +199,14 @@ int acpi_bus_set_power(acpi_handle handle, int state)
* Get device's current power state if it's unknown
* 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)
- acpi_bus_get_power(device->handle, &device->power.state);
- if (state == device->power.state) {
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
- state));
- return 0;
- }
+ if ((device->power.state == ACPI_STATE_UNKNOWN) || device->flags.force_power_state)
+ acpi_bus_get_power(device->handle, &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",
+ state));
+ return 0;
}
+
if (!device->power.states[state].flags.valid) {
printk(KERN_WARNING PREFIX "Device does not support D%d\n", state);
return -ENODEV;
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 00d6118ff1e..1ef338545df 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -455,6 +455,10 @@ int acpi_power_transition(struct acpi_device *device, int state)
goto end;
}
+ if (device->power.state == state) {
+ goto end;
+ }
+
/*
* Then we dereference all power resources used in the current list.
*/
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 15022bc8633..0ae8b9310cb 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -1356,28 +1356,32 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
static int acpi_thermal_resume(struct acpi_device *device)
{
struct acpi_thermal *tz = NULL;
- int i;
+ int i, j, power_state, result;
+
if (!device || !acpi_driver_data(device))
return -EINVAL;
tz = acpi_driver_data(device);
- acpi_thermal_get_temperature(tz);
-
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
- if (tz->trips.active[i].flags.valid) {
- tz->temperature = tz->trips.active[i].temperature;
- tz->trips.active[i].flags.enabled = 0;
-
- acpi_thermal_active(tz);
-
- tz->state.active |= tz->trips.active[i].flags.enabled;
- tz->state.active_index = i;
+ if (!(&tz->trips.active[i]))
+ 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;
+ break;
+ }
}
+ tz->state.active |= tz->trips.active[i].flags.enabled;
}
- acpi_thermal_check(tz);
+ acpi_thermal_check(tz);
return AE_OK;
}