summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2018-01-16 11:01:27 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-01-17 14:42:49 +0300
commit617fcb673090e495f58565ff0171d07abdad53a7 (patch)
tree587b42ba0d8ac2adfdab522fe4d054372719db1b /drivers/base
parent1f5c6855260141ac3115e9a065491ee2ac07f9bc (diff)
downloadlinux-617fcb673090e495f58565ff0171d07abdad53a7.tar.xz
PM / runtime: Allow no callbacks in pm_runtime_force_suspend|resume()
The pm_runtime_force_suspend|resume() helpers currently requires the device to at some level (PM domain, bus, etc), have the ->runtime_suspend|resume() callbacks assigned for it, else -ENOSYS is returned as an error. However, there are no reason for this requirement, so let's simply remove it by allowing these callbacks to be NULL. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/runtime.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index cb5e48b86453..8bef3cb2424d 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -1640,7 +1640,7 @@ static bool pm_runtime_need_not_resume(struct device *dev)
int pm_runtime_force_suspend(struct device *dev)
{
int (*callback)(struct device *);
- int ret = 0;
+ int ret;
pm_runtime_disable(dev);
if (pm_runtime_status_suspended(dev))
@@ -1648,12 +1648,7 @@ int pm_runtime_force_suspend(struct device *dev)
callback = RPM_GET_CALLBACK(dev, runtime_suspend);
- if (!callback) {
- ret = -ENOSYS;
- goto err;
- }
-
- ret = callback(dev);
+ ret = callback ? callback(dev) : 0;
if (ret)
goto err;
@@ -1704,7 +1699,7 @@ int pm_runtime_force_resume(struct device *dev)
callback = RPM_GET_CALLBACK(dev, runtime_resume);
- ret = callback ? callback(dev) : -ENOSYS;
+ ret = callback ? callback(dev) : 0;
if (ret) {
pm_runtime_set_suspended(dev);
goto out;