aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/power.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 224f729f700e..2b61719d680b 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -71,6 +71,7 @@ static struct acpi_driver acpi_power_driver = {
71 71
72struct acpi_power_resource { 72struct acpi_power_resource {
73 acpi_handle handle; 73 acpi_handle handle;
74 struct acpi_device * device;
74 acpi_bus_id name; 75 acpi_bus_id name;
75 u32 system_level; 76 u32 system_level;
76 u32 order; 77 u32 order;
@@ -203,10 +204,8 @@ static int acpi_power_on(acpi_handle handle)
203 return -ENOEXEC; 204 return -ENOEXEC;
204 205
205 /* Update the power resource's _device_ power state */ 206 /* Update the power resource's _device_ power state */
206 result = acpi_bus_get_device(resource->handle, &device); 207 device = resource->device;
207 if (result) 208 resource->device->power.state = ACPI_STATE_D0;
208 return result;
209 device->power.state = ACPI_STATE_D0;
210 209
211 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n", 210 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n",
212 resource->name)); 211 resource->name));
@@ -253,9 +252,7 @@ static int acpi_power_off_device(acpi_handle handle)
253 return -ENOEXEC; 252 return -ENOEXEC;
254 253
255 /* Update the power resource's _device_ power state */ 254 /* Update the power resource's _device_ power state */
256 result = acpi_bus_get_device(resource->handle, &device); 255 device = resource->device;
257 if (result)
258 return result;
259 device->power.state = ACPI_STATE_D3; 256 device->power.state = ACPI_STATE_D3;
260 257
261 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n", 258 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n",
@@ -545,6 +542,7 @@ static int acpi_power_add(struct acpi_device *device)
545 memset(resource, 0, sizeof(struct acpi_power_resource)); 542 memset(resource, 0, sizeof(struct acpi_power_resource));
546 543
547 resource->handle = device->handle; 544 resource->handle = device->handle;
545 resource->device = device;
548 strcpy(resource->name, device->pnp.bus_id); 546 strcpy(resource->name, device->pnp.bus_id);
549 strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); 547 strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
550 strcpy(acpi_device_class(device), ACPI_POWER_CLASS); 548 strcpy(acpi_device_class(device), ACPI_POWER_CLASS);