Commit 1b2b90cb authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki

PM / OPP: Return suspend_opp only if it is enabled

There is no point returning suspend_opp, if it is disabled by the core.
As we can't use it at all. Fix it.

Fixes: 4eafbd15 ("PM / OPP: add dev_pm_opp_get_suspend_opp() helper")
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 4eafbd15
...@@ -345,7 +345,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency); ...@@ -345,7 +345,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency);
* @dev: device for which we do this operation * @dev: device for which we do this operation
* *
* Return: This function returns pointer to the suspend opp if it is * Return: This function returns pointer to the suspend opp if it is
* defined, otherwise it returns NULL. * defined and available, otherwise it returns NULL.
* *
* Locking: This function must be called under rcu_read_lock(). opp is a rcu * Locking: This function must be called under rcu_read_lock(). opp is a rcu
* protected pointer. The reason for the same is that the opp pointer which is * protected pointer. The reason for the same is that the opp pointer which is
...@@ -356,17 +356,15 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency); ...@@ -356,17 +356,15 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency);
struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev) struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev)
{ {
struct device_opp *dev_opp; struct device_opp *dev_opp;
struct dev_pm_opp *opp;
opp_rcu_lockdep_assert(); opp_rcu_lockdep_assert();
dev_opp = _find_device_opp(dev); dev_opp = _find_device_opp(dev);
if (IS_ERR(dev_opp)) if (IS_ERR(dev_opp) || !dev_opp->suspend_opp ||
opp = NULL; !dev_opp->suspend_opp->available)
else return NULL;
opp = dev_opp->suspend_opp;
return opp; return dev_opp->suspend_opp;
} }
EXPORT_SYMBOL_GPL(dev_pm_opp_get_suspend_opp); EXPORT_SYMBOL_GPL(dev_pm_opp_get_suspend_opp);
......
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