ACPI: Do not use device power states of power resources

ACPI power resource objects have struct acpi_device components, but
they are only used for registering those resources in the device
hierarchy.  In particular, power state information stored in them is
completely useless (amnong other things, because the power resources
"devices" are not power manageable), so there is no reason for the
power resources management code to keep it up to date.

Remove the code updating device power states of power resources from
drivers/acpi/power.c.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Rafael J. Wysocki 2013-01-17 14:11:06 +01:00
parent 781d737c74
commit 722c929f32

View File

@ -193,9 +193,6 @@ static int __acpi_power_on(struct acpi_power_resource *resource)
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
/* Update the power resource's _device_ power state */
resource->device.power.state = ACPI_STATE_D0;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Power resource [%s] turned on\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Power resource [%s] turned on\n",
resource->name)); resource->name));
@ -261,16 +258,12 @@ static int acpi_power_off(acpi_handle handle)
} }
status = acpi_evaluate_object(resource->device.handle, "_OFF", NULL, NULL); status = acpi_evaluate_object(resource->device.handle, "_OFF", NULL, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status))
result = -ENODEV; result = -ENODEV;
} else { else
/* Update the power resource's _device_ power state */
resource->device.power.state = ACPI_STATE_D3;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Power resource [%s] turned off\n", "Power resource [%s] turned off\n",
resource->name)); resource->name));
}
unlock: unlock:
mutex_unlock(&resource->resource_lock); mutex_unlock(&resource->resource_lock);
@ -659,6 +652,7 @@ void acpi_add_power_resource(acpi_handle handle)
resource->name = device->pnp.bus_id; resource->name = device->pnp.bus_id;
strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_POWER_CLASS); strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
device->power.state = ACPI_STATE_UNKNOWN;
/* Evalute the object to get the system level and resource order. */ /* Evalute the object to get the system level and resource order. */
status = acpi_evaluate_object(handle, NULL, NULL, &buffer); status = acpi_evaluate_object(handle, NULL, NULL, &buffer);
@ -672,17 +666,6 @@ void acpi_add_power_resource(acpi_handle handle)
if (result) if (result)
goto err; goto err;
switch (state) {
case ACPI_POWER_RESOURCE_STATE_ON:
device->power.state = ACPI_STATE_D0;
break;
case ACPI_POWER_RESOURCE_STATE_OFF:
device->power.state = ACPI_STATE_D3;
break;
default:
device->power.state = ACPI_STATE_UNKNOWN;
}
printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device),
acpi_device_bid(device), state ? "on" : "off"); acpi_device_bid(device), state ? "on" : "off");