Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230945
b: refs/heads/master
c: d0515d9
h: refs/heads/master
i:
  230943: 59e9c03
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Len Brown committed Jan 12, 2011
1 parent a7a2fcf commit 9670ffa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 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: 36237fa0a711c309a38d7a7a9aed727e0eb76449
refs/heads/master: d0515d9fec68bace144fda57a69f4268fb875209
33 changes: 20 additions & 13 deletions trunk/drivers/acpi/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,35 +145,42 @@ static int acpi_power_get_state(acpi_handle handle, int *state)

static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
{
int result = 0, state1;
u32 i = 0;

int cur_state;
int i = 0;

if (!list || !state)
return -EINVAL;

/* The state of the list is 'on' IFF all resources are 'on'. */

for (i = 0; i < list->count; i++) {
/*
* The state of the power resource can be obtained by
* using the ACPI handle. In such case it is unnecessary to
* get the Power resource first and then get its state again.
*/
result = acpi_power_get_state(list->handles[i], &state1);
struct acpi_power_resource *resource;
acpi_handle handle = list->handles[i];
int result;

result = acpi_power_get_context(handle, &resource);
if (result)
return result;

*state = state1;
mutex_lock(&resource->resource_lock);

if (*state != ACPI_POWER_RESOURCE_STATE_ON)
result = acpi_power_get_state(handle, &cur_state);

mutex_unlock(&resource->resource_lock);

if (result)
return result;

if (cur_state != ACPI_POWER_RESOURCE_STATE_ON)
break;
}

ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n",
*state ? "on" : "off"));
cur_state ? "on" : "off"));

return result;
*state = cur_state;

return 0;
}

static int __acpi_power_on(struct acpi_power_resource *resource)
Expand Down

0 comments on commit 9670ffa

Please sign in to comment.