aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-01 20:40:36 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-14 18:15:17 -0500
commitdee8370cc87e505ef39567f0974e73d59e75d76b (patch)
treea8016fcb6edbdf2fbb01c6d50ded276eed626829 /include/acpi
parentcd7bd02d319eb34fa33d1705cf63f64928643708 (diff)
ACPI / PM: Split device wakeup management routines
Two device wakeup management routines in device_pm.c and sleep.c, acpi_pm_device_run_wake() and acpi_pm_device_sleep_wake(), take a device pointer argument and use it to obtain the ACPI handle of the corresponding ACPI namespace node. That handle is then used to get the address of the struct acpi_device object corresponding to the struct device passed as the argument. Unfortunately, that last operation may be costly, because it involves taking the global ACPI namespace mutex, so it shouldn't be carried out too often. However, the callers of those routines usually call them in a row with acpi_pm_device_sleep_state() which also takes that mutex for the same reason, so it would be more efficient if they ran acpi_bus_get_device() themselves to obtain a pointer to the struct acpi_device object in question and then passed that pointer to the appropriate PM routines. To make that possible, split each of the PM routines mentioned above in two parts, one taking a struct acpi_device pointer argument and the other implementing the current interface for compatibility. Additionally, change acpi_pm_device_run_wake() to actually return an error code if there is an error while setting up runtime remote wakeup for the device. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/acpi')
-rw-r--r--include/acpi/acpi_bus.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index a8080dfe7183..a635942bcd51 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -455,8 +455,13 @@ static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
455#endif 455#endif
456 456
457#ifdef CONFIG_PM_RUNTIME 457#ifdef CONFIG_PM_RUNTIME
458int __acpi_device_run_wake(struct acpi_device *, bool);
458int acpi_pm_device_run_wake(struct device *, bool); 459int acpi_pm_device_run_wake(struct device *, bool);
459#else 460#else
461static inline int __acpi_device_run_wake(struct acpi_device *adev, bool en)
462{
463 return -ENODEV;
464}
460static inline int acpi_pm_device_run_wake(struct device *dev, bool enable) 465static inline int acpi_pm_device_run_wake(struct device *dev, bool enable)
461{ 466{
462 return -ENODEV; 467 return -ENODEV;
@@ -464,8 +469,14 @@ static inline int acpi_pm_device_run_wake(struct device *dev, bool enable)
464#endif 469#endif
465 470
466#ifdef CONFIG_PM_SLEEP 471#ifdef CONFIG_PM_SLEEP
472int __acpi_device_sleep_wake(struct acpi_device *, u32, bool);
467int acpi_pm_device_sleep_wake(struct device *, bool); 473int acpi_pm_device_sleep_wake(struct device *, bool);
468#else 474#else
475static inline int __acpi_device_sleep_wake(struct acpi_device *adev,
476 u32 target_state, bool enable)
477{
478 return -ENODEV;
479}
469static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) 480static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
470{ 481{
471 return -ENODEV; 482 return -ENODEV;