Commit 29df0ee1 authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki

PM / OPP: reuse find_device_opp() instead of duplicating code

Reuse find_device_opp() in opp_set_availability() instead of duplicating code.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 86453b47
...@@ -597,7 +597,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_remove); ...@@ -597,7 +597,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_remove);
static int opp_set_availability(struct device *dev, unsigned long freq, static int opp_set_availability(struct device *dev, unsigned long freq,
bool availability_req) bool availability_req)
{ {
struct device_opp *tmp_dev_opp, *dev_opp = ERR_PTR(-ENODEV); struct device_opp *dev_opp;
struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV); struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV);
int r = 0; int r = 0;
...@@ -611,12 +611,7 @@ static int opp_set_availability(struct device *dev, unsigned long freq, ...@@ -611,12 +611,7 @@ static int opp_set_availability(struct device *dev, unsigned long freq,
mutex_lock(&dev_opp_list_lock); mutex_lock(&dev_opp_list_lock);
/* Find the device_opp */ /* Find the device_opp */
list_for_each_entry(tmp_dev_opp, &dev_opp_list, node) { dev_opp = find_device_opp(dev);
if (dev == tmp_dev_opp->dev) {
dev_opp = tmp_dev_opp;
break;
}
}
if (IS_ERR(dev_opp)) { if (IS_ERR(dev_opp)) {
r = PTR_ERR(dev_opp); r = PTR_ERR(dev_opp);
dev_warn(dev, "%s: Device OPP not found (%d)\n", __func__, r); dev_warn(dev, "%s: Device OPP not found (%d)\n", __func__, r);
......
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