summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2018-11-22 06:34:00 +0100
committerViresh Kumar <viresh.kumar@linaro.org>2018-12-14 11:57:43 +0100
commit699e21e4170add1c4c954838d94feec2014ee83c (patch)
tree349ef2b913680cd918e6f5721ccce22f8b42132f /drivers
parentPM / Domains: Make genpd performance states orthogonal to the idlestates (diff)
downloadlinux-699e21e4170add1c4c954838d94feec2014ee83c.tar.xz
linux-699e21e4170add1c4c954838d94feec2014ee83c.zip
OPP: Improve _find_table_of_opp_np()
Make _find_table_of_opp_np() more efficient by using of_get_parent() to find the parent OPP table node. Tested-by: Rajendra Nayak <rnayak@codeaurora.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/opp/of.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index 3740822b4197..7f09ae8fc050 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -114,19 +114,25 @@ static struct device_node *of_parse_required_opp(struct device_node *np,
static struct opp_table *_find_table_of_opp_np(struct device_node *opp_np)
{
struct opp_table *opp_table;
- struct dev_pm_opp *opp;
+ struct device_node *opp_table_np;
lockdep_assert_held(&opp_table_lock);
+ opp_table_np = of_get_parent(opp_np);
+ if (!opp_table_np)
+ goto err;
+
+ /* It is safe to put the node now as all we need now is its address */
+ of_node_put(opp_table_np);
+
list_for_each_entry(opp_table, &opp_tables, node) {
- opp = _find_opp_of_np(opp_table, opp_np);
- if (opp) {
- dev_pm_opp_put(opp);
+ if (opp_table_np == opp_table->np) {
_get_opp_table_kref(opp_table);
return opp_table;
}
}
+err:
return ERR_PTR(-ENODEV);
}