diff options
| -rw-r--r-- | drivers/acpi/bus.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 3188da3df8da..a41be56c1cc0 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
| @@ -182,6 +182,24 @@ EXPORT_SYMBOL(acpi_bus_get_private_data); | |||
| 182 | Power Management | 182 | Power Management |
| 183 | -------------------------------------------------------------------------- */ | 183 | -------------------------------------------------------------------------- */ |
| 184 | 184 | ||
| 185 | static const char *state_string(int state) | ||
| 186 | { | ||
| 187 | switch (state) { | ||
| 188 | case ACPI_STATE_D0: | ||
| 189 | return "D0"; | ||
| 190 | case ACPI_STATE_D1: | ||
| 191 | return "D1"; | ||
| 192 | case ACPI_STATE_D2: | ||
| 193 | return "D2"; | ||
| 194 | case ACPI_STATE_D3_HOT: | ||
| 195 | return "D3hot"; | ||
| 196 | case ACPI_STATE_D3_COLD: | ||
| 197 | return "D3"; | ||
| 198 | default: | ||
| 199 | return "(unknown)"; | ||
| 200 | } | ||
| 201 | } | ||
| 202 | |||
| 185 | static int __acpi_bus_get_power(struct acpi_device *device, int *state) | 203 | static int __acpi_bus_get_power(struct acpi_device *device, int *state) |
| 186 | { | 204 | { |
| 187 | int result = 0; | 205 | int result = 0; |
| @@ -215,8 +233,8 @@ static int __acpi_bus_get_power(struct acpi_device *device, int *state) | |||
| 215 | device->parent->power.state : ACPI_STATE_D0; | 233 | device->parent->power.state : ACPI_STATE_D0; |
| 216 | } | 234 | } |
| 217 | 235 | ||
| 218 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n", | 236 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is %s\n", |
| 219 | device->pnp.bus_id, *state)); | 237 | device->pnp.bus_id, state_string(*state))); |
| 220 | 238 | ||
| 221 | return 0; | 239 | return 0; |
| 222 | } | 240 | } |
| @@ -234,13 +252,14 @@ static int __acpi_bus_set_power(struct acpi_device *device, int state) | |||
| 234 | /* Make sure this is a valid target state */ | 252 | /* Make sure this is a valid target state */ |
| 235 | 253 | ||
| 236 | if (state == device->power.state) { | 254 | if (state == device->power.state) { |
| 237 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", | 255 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at %s\n", |
| 238 | state)); | 256 | state_string(state))); |
| 239 | return 0; | 257 | return 0; |
| 240 | } | 258 | } |
| 241 | 259 | ||
| 242 | if (!device->power.states[state].flags.valid) { | 260 | if (!device->power.states[state].flags.valid) { |
| 243 | printk(KERN_WARNING PREFIX "Device does not support D%d\n", state); | 261 | printk(KERN_WARNING PREFIX "Device does not support %s\n", |
| 262 | state_string(state)); | ||
| 244 | return -ENODEV; | 263 | return -ENODEV; |
| 245 | } | 264 | } |
| 246 | if (device->parent && (state < device->parent->power.state)) { | 265 | if (device->parent && (state < device->parent->power.state)) { |
| @@ -294,13 +313,13 @@ static int __acpi_bus_set_power(struct acpi_device *device, int state) | |||
| 294 | end: | 313 | end: |
| 295 | if (result) | 314 | if (result) |
| 296 | printk(KERN_WARNING PREFIX | 315 | printk(KERN_WARNING PREFIX |
| 297 | "Device [%s] failed to transition to D%d\n", | 316 | "Device [%s] failed to transition to %s\n", |
| 298 | device->pnp.bus_id, state); | 317 | device->pnp.bus_id, state_string(state)); |
| 299 | else { | 318 | else { |
| 300 | device->power.state = state; | 319 | device->power.state = state; |
| 301 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 320 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 302 | "Device [%s] transitioned to D%d\n", | 321 | "Device [%s] transitioned to %s\n", |
| 303 | device->pnp.bus_id, state)); | 322 | device->pnp.bus_id, state_string(state))); |
| 304 | } | 323 | } |
| 305 | 324 | ||
| 306 | return result; | 325 | return result; |
