Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230899
b: refs/heads/master
c: 488a76c
h: refs/heads/master
i:
  230897: f659421
  230895: 7afe0d9
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Len Brown committed Jan 12, 2011
1 parent a737146 commit 2bb0a8f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bf325f9538d8c89312be305b9779edbcb436af00
refs/heads/master: 488a76c52606199100adf09c8eb7cbedbd94e9d9
2 changes: 1 addition & 1 deletion trunk/drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ static int __acpi_bus_set_power(struct acpi_device *device, int state)

/* Make sure this is a valid target state */

if ((state == device->power.state) && !device->flags.force_power_state) {
if (state == device->power.state) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
state));
return 0;
Expand Down
27 changes: 7 additions & 20 deletions trunk/drivers/acpi/fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long
if (!device)
return -EINVAL;

result = acpi_bus_get_power(device->handle, &acpi_state);
result = acpi_bus_update_power(device->handle, &acpi_state);
if (result)
return result;

Expand Down Expand Up @@ -123,7 +123,6 @@ static struct thermal_cooling_device_ops fan_cooling_ops = {
static int acpi_fan_add(struct acpi_device *device)
{
int result = 0;
int state = 0;
struct thermal_cooling_device *cdev;

if (!device)
Expand All @@ -132,16 +131,12 @@ static int acpi_fan_add(struct acpi_device *device)
strcpy(acpi_device_name(device), "Fan");
strcpy(acpi_device_class(device), ACPI_FAN_CLASS);

result = acpi_bus_get_power(device->handle, &state);
result = acpi_bus_update_power(device->handle, NULL);
if (result) {
printk(KERN_ERR PREFIX "Reading power state\n");
printk(KERN_ERR PREFIX "Setting initial power state\n");
goto end;
}

device->flags.force_power_state = 1;
acpi_bus_set_power(device->handle, state);
device->flags.force_power_state = 0;

cdev = thermal_cooling_device_register("Fan", device,
&fan_cooling_ops);
if (IS_ERR(cdev)) {
Expand Down Expand Up @@ -200,22 +195,14 @@ static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state)

static int acpi_fan_resume(struct acpi_device *device)
{
int result = 0;
int power_state = 0;
int result;

if (!device)
return -EINVAL;

result = acpi_bus_get_power(device->handle, &power_state);
if (result) {
printk(KERN_ERR PREFIX
"Error reading fan power state\n");
return result;
}

device->flags.force_power_state = 1;
acpi_bus_set_power(device->handle, power_state);
device->flags.force_power_state = 0;
result = acpi_bus_update_power(device->handle, NULL);
if (result)
printk(KERN_ERR PREFIX "Error updating fan power state\n");

return result;
}
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/acpi/thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,8 +1059,9 @@ static int acpi_thermal_resume(struct acpi_device *device)
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);
result = acpi_bus_update_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;
Expand Down
3 changes: 1 addition & 2 deletions trunk/include/acpi/acpi_bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ struct acpi_device_flags {
u32 power_manageable:1;
u32 performance_manageable:1;
u32 wake_capable:1; /* Wakeup(_PRW) supported? */
u32 force_power_state:1;
u32 reserved:22;
u32 reserved:23;
};

/* File System */
Expand Down

0 comments on commit 2bb0a8f

Please sign in to comment.