Commit 617fcb67 authored by Ulf Hansson's avatar Ulf Hansson Committed by Rafael J. Wysocki

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: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 1f5c6855
...@@ -1640,7 +1640,7 @@ static bool pm_runtime_need_not_resume(struct device *dev) ...@@ -1640,7 +1640,7 @@ static bool pm_runtime_need_not_resume(struct device *dev)
int pm_runtime_force_suspend(struct device *dev) int pm_runtime_force_suspend(struct device *dev)
{ {
int (*callback)(struct device *); int (*callback)(struct device *);
int ret = 0; int ret;
pm_runtime_disable(dev); pm_runtime_disable(dev);
if (pm_runtime_status_suspended(dev)) if (pm_runtime_status_suspended(dev))
...@@ -1648,12 +1648,7 @@ int pm_runtime_force_suspend(struct device *dev) ...@@ -1648,12 +1648,7 @@ int pm_runtime_force_suspend(struct device *dev)
callback = RPM_GET_CALLBACK(dev, runtime_suspend); callback = RPM_GET_CALLBACK(dev, runtime_suspend);
if (!callback) { ret = callback ? callback(dev) : 0;
ret = -ENOSYS;
goto err;
}
ret = callback(dev);
if (ret) if (ret)
goto err; goto err;
...@@ -1704,7 +1699,7 @@ int pm_runtime_force_resume(struct device *dev) ...@@ -1704,7 +1699,7 @@ int pm_runtime_force_resume(struct device *dev)
callback = RPM_GET_CALLBACK(dev, runtime_resume); callback = RPM_GET_CALLBACK(dev, runtime_resume);
ret = callback ? callback(dev) : -ENOSYS; ret = callback ? callback(dev) : 0;
if (ret) { if (ret) {
pm_runtime_set_suspended(dev); pm_runtime_set_suspended(dev);
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment