Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350926
b: refs/heads/master
c: 96bfd3c
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki committed Jan 17, 2013
1 parent 1a6491a commit 8e9ddcf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 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: ad0c3b0e4863185a9f8874a655a8d2999c915131
refs/heads/master: 96bfd3cee2a741906b3ef5c1096d2f0a0b8025e0
18 changes: 12 additions & 6 deletions trunk/drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ EXPORT_SYMBOL(acpi_bus_get_private_data);
Power Management
-------------------------------------------------------------------------- */

static const char *state_string(int state)
/**
* acpi_power_state_string - String representation of ACPI device power state.
* @state: ACPI device power state to return the string representation of.
*/
const char *acpi_power_state_string(int state)
{
switch (state) {
case ACPI_STATE_D0:
Expand Down Expand Up @@ -260,7 +264,7 @@ int acpi_device_get_power(struct acpi_device *device, int *state)

out:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is %s\n",
device->pnp.bus_id, state_string(*state)));
device->pnp.bus_id, acpi_power_state_string(*state)));

return 0;
}
Expand Down Expand Up @@ -288,13 +292,13 @@ int acpi_device_set_power(struct acpi_device *device, int state)

if (state == device->power.state) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at %s\n",
state_string(state)));
acpi_power_state_string(state)));
return 0;
}

if (!device->power.states[state].flags.valid) {
printk(KERN_WARNING PREFIX "Device does not support %s\n",
state_string(state));
acpi_power_state_string(state));
return -ENODEV;
}
if (device->parent && (state < device->parent->power.state)) {
Expand Down Expand Up @@ -362,12 +366,14 @@ int acpi_device_set_power(struct acpi_device *device, int state)
if (result)
printk(KERN_WARNING PREFIX
"Device [%s] failed to transition to %s\n",
device->pnp.bus_id, state_string(state));
device->pnp.bus_id,
acpi_power_state_string(state));
else {
device->power.state = state;
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Device [%s] transitioned to %s\n",
device->pnp.bus_id, state_string(state)));
device->pnp.bus_id,
acpi_power_state_string(state)));
}

return result;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/acpi/acpi_bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle,
unsigned long long *sta);
int acpi_bus_get_status(struct acpi_device *device);
int acpi_bus_set_power(acpi_handle handle, int state);
const char *acpi_power_state_string(int state);
int acpi_device_get_power(struct acpi_device *device, int *state);
int acpi_device_set_power(struct acpi_device *device, int state);
int acpi_bus_update_power(acpi_handle handle, int *state_p);
Expand Down

0 comments on commit 8e9ddcf

Please sign in to comment.