diff options
Diffstat (limited to 'drivers/acpi/power.c')
| -rw-r--r-- | drivers/acpi/power.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 67dedeed144..4c9c2fb5d98 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
| @@ -213,11 +213,13 @@ static int acpi_power_on(acpi_handle handle) | |||
| 213 | resource->name)); | 213 | resource->name)); |
| 214 | } else { | 214 | } else { |
| 215 | result = __acpi_power_on(resource); | 215 | result = __acpi_power_on(resource); |
| 216 | if (result) | ||
| 217 | resource->ref_count--; | ||
| 216 | } | 218 | } |
| 217 | 219 | ||
| 218 | mutex_unlock(&resource->resource_lock); | 220 | mutex_unlock(&resource->resource_lock); |
| 219 | 221 | ||
| 220 | return 0; | 222 | return result; |
| 221 | } | 223 | } |
| 222 | 224 | ||
| 223 | static int acpi_power_off_device(acpi_handle handle) | 225 | static int acpi_power_off_device(acpi_handle handle) |
| @@ -465,10 +467,12 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
| 465 | struct acpi_handle_list *tl = NULL; /* Target Resources */ | 467 | struct acpi_handle_list *tl = NULL; /* Target Resources */ |
| 466 | int i = 0; | 468 | int i = 0; |
| 467 | 469 | ||
| 468 | |||
| 469 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) | 470 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) |
| 470 | return -EINVAL; | 471 | return -EINVAL; |
| 471 | 472 | ||
| 473 | if (device->power.state == state) | ||
| 474 | return 0; | ||
| 475 | |||
| 472 | if ((device->power.state < ACPI_STATE_D0) | 476 | if ((device->power.state < ACPI_STATE_D0) |
| 473 | || (device->power.state > ACPI_STATE_D3)) | 477 | || (device->power.state > ACPI_STATE_D3)) |
| 474 | return -ENODEV; | 478 | return -ENODEV; |
| @@ -488,10 +492,6 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
| 488 | goto end; | 492 | goto end; |
| 489 | } | 493 | } |
| 490 | 494 | ||
| 491 | if (device->power.state == state) { | ||
| 492 | goto end; | ||
| 493 | } | ||
| 494 | |||
| 495 | /* | 495 | /* |
| 496 | * Then we dereference all power resources used in the current list. | 496 | * Then we dereference all power resources used in the current list. |
| 497 | */ | 497 | */ |
