aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi/sleep.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-02 01:40:36 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-15 00:15:17 +0100
commitdee8370cc87e505ef39567f0974e73d59e75d76b (patch)
treea8016fcb6edbdf2fbb01c6d50ded276eed626829 /drivers/acpi/sleep.c
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 'drivers/acpi/sleep.c')
-rw-r--r--drivers/acpi/sleep.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 241304ee406..77c517f6f6d 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -724,15 +724,13 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
handle = DEVICE_ACPI_HANDLE(dev);
if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) {
- dev_dbg(dev, "ACPI handle has no context in %s!\n", __func__);
+ dev_dbg(dev, "ACPI handle without context in %s!\n", __func__);
return -ENODEV;
}
- error = enable ?
- acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) :
- acpi_disable_wakeup_device_power(adev);
+ error = __acpi_device_sleep_wake(adev, acpi_target_sleep_state, enable);
if (!error)
- dev_info(dev, "wake-up capability %s by ACPI\n",
+ dev_info(dev, "System wakeup %s by ACPI\n",
enable ? "enabled" : "disabled");
return error;