diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-17 08:11:08 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-17 08:11:08 -0500 |
commit | 96bfd3cee2a741906b3ef5c1096d2f0a0b8025e0 (patch) | |
tree | 9efdfad1f1206821057931f0fb67313eada8727d | |
parent | ad0c3b0e4863185a9f8874a655a8d2999c915131 (diff) |
ACPI / PM: Common string representations of device power states
The function returning string representations of ACPI device power
states, state_string((), is now static, because it is only used
internally in drivers/acpi/bus.c. However, it will be used outside
of that file going forward, so rename it to
acpi_power_state_string(), add a kerneldoc comment to it and add its
header to acpi_bus.h.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/bus.c | 18 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 1 |
2 files changed, 13 insertions, 6 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 0e1441cc4d7f..6c9b16c16660 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -182,7 +182,11 @@ 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) | 185 | /** |
186 | * acpi_power_state_string - String representation of ACPI device power state. | ||
187 | * @state: ACPI device power state to return the string representation of. | ||
188 | */ | ||
189 | const char *acpi_power_state_string(int state) | ||
186 | { | 190 | { |
187 | switch (state) { | 191 | switch (state) { |
188 | case ACPI_STATE_D0: | 192 | case ACPI_STATE_D0: |
@@ -260,7 +264,7 @@ int acpi_device_get_power(struct acpi_device *device, int *state) | |||
260 | 264 | ||
261 | out: | 265 | out: |
262 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is %s\n", | 266 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is %s\n", |
263 | device->pnp.bus_id, state_string(*state))); | 267 | device->pnp.bus_id, acpi_power_state_string(*state))); |
264 | 268 | ||
265 | return 0; | 269 | return 0; |
266 | } | 270 | } |
@@ -288,13 +292,13 @@ int acpi_device_set_power(struct acpi_device *device, int state) | |||
288 | 292 | ||
289 | if (state == device->power.state) { | 293 | if (state == device->power.state) { |
290 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at %s\n", | 294 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at %s\n", |
291 | state_string(state))); | 295 | acpi_power_state_string(state))); |
292 | return 0; | 296 | return 0; |
293 | } | 297 | } |
294 | 298 | ||
295 | if (!device->power.states[state].flags.valid) { | 299 | if (!device->power.states[state].flags.valid) { |
296 | printk(KERN_WARNING PREFIX "Device does not support %s\n", | 300 | printk(KERN_WARNING PREFIX "Device does not support %s\n", |
297 | state_string(state)); | 301 | acpi_power_state_string(state)); |
298 | return -ENODEV; | 302 | return -ENODEV; |
299 | } | 303 | } |
300 | if (device->parent && (state < device->parent->power.state)) { | 304 | if (device->parent && (state < device->parent->power.state)) { |
@@ -362,12 +366,14 @@ int acpi_device_set_power(struct acpi_device *device, int state) | |||
362 | if (result) | 366 | if (result) |
363 | printk(KERN_WARNING PREFIX | 367 | printk(KERN_WARNING PREFIX |
364 | "Device [%s] failed to transition to %s\n", | 368 | "Device [%s] failed to transition to %s\n", |
365 | device->pnp.bus_id, state_string(state)); | 369 | device->pnp.bus_id, |
370 | acpi_power_state_string(state)); | ||
366 | else { | 371 | else { |
367 | device->power.state = state; | 372 | device->power.state = state; |
368 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 373 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
369 | "Device [%s] transitioned to %s\n", | 374 | "Device [%s] transitioned to %s\n", |
370 | device->pnp.bus_id, state_string(state))); | 375 | device->pnp.bus_id, |
376 | acpi_power_state_string(state))); | ||
371 | } | 377 | } |
372 | 378 | ||
373 | return result; | 379 | return result; |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 9d7c2ca0f1f7..71eceb99d411 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -331,6 +331,7 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle, | |||
331 | unsigned long long *sta); | 331 | unsigned long long *sta); |
332 | int acpi_bus_get_status(struct acpi_device *device); | 332 | int acpi_bus_get_status(struct acpi_device *device); |
333 | int acpi_bus_set_power(acpi_handle handle, int state); | 333 | int acpi_bus_set_power(acpi_handle handle, int state); |
334 | const char *acpi_power_state_string(int state); | ||
334 | int acpi_device_get_power(struct acpi_device *device, int *state); | 335 | int acpi_device_get_power(struct acpi_device *device, int *state); |
335 | int acpi_device_set_power(struct acpi_device *device, int state); | 336 | int acpi_device_set_power(struct acpi_device *device, int state); |
336 | int acpi_bus_update_power(acpi_handle handle, int *state_p); | 337 | int acpi_bus_update_power(acpi_handle handle, int *state_p); |