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>
This commit is contained in:
parent
c7788792a5
commit
ec4602a958
3 changed files with 70 additions and 98 deletions
|
@ -377,7 +377,6 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle,
|
|||
unsigned long long *sta);
|
||||
int acpi_bus_get_status(struct acpi_device *device);
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
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);
|
||||
|
@ -385,41 +384,12 @@ int acpi_device_set_power(struct acpi_device *device, int state);
|
|||
int acpi_bus_init_power(struct acpi_device *device);
|
||||
int acpi_bus_update_power(acpi_handle handle, int *state_p);
|
||||
bool acpi_bus_power_manageable(acpi_handle handle);
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
bool acpi_bus_can_wakeup(acpi_handle handle);
|
||||
#else /* !CONFIG_PM */
|
||||
static inline int acpi_bus_set_power(acpi_handle handle, int state)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline const char *acpi_power_state_string(int state)
|
||||
{
|
||||
return "D0";
|
||||
}
|
||||
static inline int acpi_device_get_power(struct acpi_device *device, int *state)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int acpi_device_set_power(struct acpi_device *device, int state)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int acpi_bus_init_power(struct acpi_device *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int acpi_bus_update_power(acpi_handle handle, int *state_p)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline bool acpi_bus_power_manageable(acpi_handle handle)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
static inline bool acpi_bus_can_wakeup(acpi_handle handle)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif /* !CONFIG_PM */
|
||||
#else
|
||||
static inline bool acpi_bus_can_wakeup(acpi_handle handle) { return false; }
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ACPI_PROC_EVENT
|
||||
int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue