diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-01 20:40:45 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-14 18:15:18 -0500 |
commit | 078eb12648c2f8bba48921f60ec2cec3e1bbc051 (patch) | |
tree | 18a669b4363a520e89213f9ae4d326611cab5cca /include/acpi | |
parent | dee8370cc87e505ef39567f0974e73d59e75d76b (diff) |
ACPI / PM: Provide device PM functions operating on struct acpi_device
If the caller of acpi_bus_set_power() already has a pointer to the
struct acpi_device object corresponding to the device in question, it
doesn't make sense for it to go through acpi_bus_get_device(), which
may be costly, because it involves acquiring the global ACPI
namespace mutex.
For this reason, export the function operating on struct acpi_device
objects used internally by acpi_bus_set_power(), so that it may be
called instead of acpi_bus_set_power() in the above case, and change
its name to acpi_device_set_power().
Additionally, introduce two inline wrappers for checking ACPI PM
capabilities of devices represented by struct acpi_device objects.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/acpi')
-rw-r--r-- | include/acpi/acpi_bus.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index a635942bcd51..35812b6e0427 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -339,6 +339,7 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle, | |||
339 | unsigned long long *sta); | 339 | unsigned long long *sta); |
340 | int acpi_bus_get_status(struct acpi_device *device); | 340 | int acpi_bus_get_status(struct acpi_device *device); |
341 | int acpi_bus_set_power(acpi_handle handle, int state); | 341 | int acpi_bus_set_power(acpi_handle handle, int state); |
342 | int acpi_device_set_power(struct acpi_device *device, int state); | ||
342 | int acpi_bus_update_power(acpi_handle handle, int *state_p); | 343 | int acpi_bus_update_power(acpi_handle handle, int *state_p); |
343 | bool acpi_bus_power_manageable(acpi_handle handle); | 344 | bool acpi_bus_power_manageable(acpi_handle handle); |
344 | bool acpi_bus_can_wakeup(acpi_handle handle); | 345 | bool acpi_bus_can_wakeup(acpi_handle handle); |
@@ -483,6 +484,16 @@ static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | |||
483 | } | 484 | } |
484 | #endif | 485 | #endif |
485 | 486 | ||
487 | static inline bool acpi_device_power_manageable(struct acpi_device *adev) | ||
488 | { | ||
489 | return adev->flags.power_manageable; | ||
490 | } | ||
491 | |||
492 | static inline bool acpi_device_can_wakeup(struct acpi_device *adev) | ||
493 | { | ||
494 | return adev->wakeup.flags.valid; | ||
495 | } | ||
496 | |||
486 | #else /* CONFIG_ACPI */ | 497 | #else /* CONFIG_ACPI */ |
487 | 498 | ||
488 | static inline int register_acpi_bus_type(void *bus) { return 0; } | 499 | static inline int register_acpi_bus_type(void *bus) { return 0; } |