diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-05-16 16:29:28 -0400 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-05-21 18:19:28 -0400 |
| commit | ec4602a9588a196fa1a9af46bfdd37cbf5792db4 (patch) | |
| tree | a7b21b2f8afd0f3b1796311ded8128dcdd38a9ab /include | |
| parent | c7788792a5e7b0d5d7f96d0766b4cb6112d47d75 (diff) | |
ACPI / PM: Allow device power states to be used for CONFIG_PM unset
Currently, drivers/acpi/device_pm.c depends on CONFIG_PM and all of
the functions defined in there are replaced with static inline stubs
if that option is unset. However, CONFIG_PM means, roughly, "runtime
PM or suspend/hibernation support" and some of those functions are
useful regardless of that. For example, they are used by the ACPI
fan driver for controlling fans and acpi_device_set_power() is called
during device removal. Moreover, device initialization may depend on
setting device power states properly.
For these reasons, make the routines manipulating ACPI device power
states defined in drivers/acpi/device_pm.c available for CONFIG_PM
unset too.
Reported-by: Zhang Rui <rui.zhang@intel.com>
Reported-and-tested-by: Michel Lespinasse <walken@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: 3.9+ <stable@vger.kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/acpi/acpi_bus.h | 40 |
1 files changed, 5 insertions, 35 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 98db31d9f9b4..636c59f2003a 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
| @@ -377,7 +377,6 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle, | |||
| 377 | unsigned long long *sta); | 377 | unsigned long long *sta); |
| 378 | int acpi_bus_get_status(struct acpi_device *device); | 378 | int acpi_bus_get_status(struct acpi_device *device); |
| 379 | 379 | ||
| 380 | #ifdef CONFIG_PM | ||
| 381 | int acpi_bus_set_power(acpi_handle handle, int state); | 380 | int acpi_bus_set_power(acpi_handle handle, int state); |
| 382 | const char *acpi_power_state_string(int state); | 381 | const char *acpi_power_state_string(int state); |
| 383 | int acpi_device_get_power(struct acpi_device *device, int *state); | 382 | int acpi_device_get_power(struct acpi_device *device, int *state); |
| @@ -385,41 +384,12 @@ int acpi_device_set_power(struct acpi_device *device, int state); | |||
| 385 | int acpi_bus_init_power(struct acpi_device *device); | 384 | int acpi_bus_init_power(struct acpi_device *device); |
| 386 | int acpi_bus_update_power(acpi_handle handle, int *state_p); | 385 | int acpi_bus_update_power(acpi_handle handle, int *state_p); |
| 387 | bool acpi_bus_power_manageable(acpi_handle handle); | 386 | bool acpi_bus_power_manageable(acpi_handle handle); |
| 387 | |||
| 388 | #ifdef CONFIG_PM | ||
| 388 | bool acpi_bus_can_wakeup(acpi_handle handle); | 389 | bool acpi_bus_can_wakeup(acpi_handle handle); |
| 389 | #else /* !CONFIG_PM */ | 390 | #else |
| 390 | static inline int acpi_bus_set_power(acpi_handle handle, int state) | 391 | static inline bool acpi_bus_can_wakeup(acpi_handle handle) { return false; } |
| 391 | { | 392 | #endif |
| 392 | return 0; | ||
| 393 | } | ||
| 394 | static inline const char *acpi_power_state_string(int state) | ||
| 395 | { | ||
| 396 | return "D0"; | ||
| 397 | } | ||
| 398 | static inline int acpi_device_get_power(struct acpi_device *device, int *state) | ||
| 399 | { | ||
| 400 | return 0; | ||
| 401 | } | ||
| 402 | static inline int acpi_device_set_power(struct acpi_device *device, int state) | ||
| 403 | { | ||
| 404 | return 0; | ||
| 405 | } | ||
| 406 | static inline int acpi_bus_init_power(struct acpi_device *device) | ||
| 407 | { | ||
| 408 | return 0; | ||
| 409 | } | ||
| 410 | static inline int acpi_bus_update_power(acpi_handle handle, int *state_p) | ||
| 411 | { | ||
| 412 | return 0; | ||
| 413 | } | ||
| 414 | static inline bool acpi_bus_power_manageable(acpi_handle handle) | ||
| 415 | { | ||
| 416 | return false; | ||
| 417 | } | ||
| 418 | static inline bool acpi_bus_can_wakeup(acpi_handle handle) | ||
| 419 | { | ||
| 420 | return false; | ||
| 421 | } | ||
| 422 | #endif /* !CONFIG_PM */ | ||
| 423 | 393 | ||
| 424 | #ifdef CONFIG_ACPI_PROC_EVENT | 394 | #ifdef CONFIG_ACPI_PROC_EVENT |
| 425 | int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data); | 395 | int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data); |
