Skip to content

Commit 29df0ee

Browse files
vireshkrafaeljw
authored andcommitted
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: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 86453b4 commit 29df0ee

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

drivers/base/power/opp.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_remove);
597597
static int opp_set_availability(struct device *dev, unsigned long freq,
598598
bool availability_req)
599599
{
600-
struct device_opp *tmp_dev_opp, *dev_opp = ERR_PTR(-ENODEV);
600+
struct device_opp *dev_opp;
601601
struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV);
602602
int r = 0;
603603

@@ -611,12 +611,7 @@ static int opp_set_availability(struct device *dev, unsigned long freq,
611611
mutex_lock(&dev_opp_list_lock);
612612

613613
/* Find the device_opp */
614-
list_for_each_entry(tmp_dev_opp, &dev_opp_list, node) {
615-
if (dev == tmp_dev_opp->dev) {
616-
dev_opp = tmp_dev_opp;
617-
break;
618-
}
619-
}
614+
dev_opp = find_device_opp(dev);
620615
if (IS_ERR(dev_opp)) {
621616
r = PTR_ERR(dev_opp);
622617
dev_warn(dev, "%s: Device OPP not found (%d)\n", __func__, r);

0 commit comments

Comments
 (0)