From: Viresh Kumar <viresh.kumar@linaro.org>
To: ulf.hansson@linaro.org, Rafael Wysocki <rjw@rjwysocki.net>,
Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
Stephen Boyd <sboyd@kernel.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
linux-pm@vger.kernel.org,
Vincent Guittot <vincent.guittot@linaro.org>,
rnayak@codeaurora.org, niklas.cassel@linaro.org,
linux-kernel@vger.kernel.org
Subject: [PATCH V4 2/7] OPP: Improve _find_table_of_opp_np()
Date: Fri, 14 Dec 2018 15:45:28 +0530 [thread overview]
Message-ID: <184bbc28f982752cc040f0b9286516c3897e2808.1544782279.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1544782279.git.viresh.kumar@linaro.org>
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>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/opp/of.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index 3ef7f38c0986..8e57d257be77 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);
}
--
2.19.1.568.g152ad8e3369a
next prev parent reply other threads:[~2018-12-14 10:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-14 10:15 [PATCH V4 0/7] PM / Domains: Allow performance state propagation Viresh Kumar
2018-12-14 10:15 ` [PATCH V4 1/7] PM / Domains: Make genpd performance states orthogonal to the idlestates Viresh Kumar
2018-12-14 10:15 ` Viresh Kumar [this message]
2018-12-14 10:40 ` [PATCH V4 2/7] OPP: Improve _find_table_of_opp_np() Ulf Hansson
2018-12-14 10:15 ` [PATCH V4 3/7] OPP: Add dev_pm_opp_xlate_performance_state() helper Viresh Kumar
2018-12-14 10:40 ` Ulf Hansson
2018-12-14 10:15 ` [PATCH V4 4/7] OPP: Don't return 0 on error from of_get_required_opp_performance_state() Viresh Kumar
2018-12-14 10:40 ` Ulf Hansson
2018-12-14 10:15 ` [PATCH V4 5/7] PM / Domains: Save OPP table pointer in genpd Viresh Kumar
2018-12-14 10:40 ` Ulf Hansson
2018-12-14 10:15 ` [PATCH V4 6/7] PM / Domains: Factorize dev_pm_genpd_set_performance_state() Viresh Kumar
2018-12-14 10:40 ` Ulf Hansson
2018-12-14 10:47 ` Viresh Kumar
2018-12-14 10:15 ` [PATCH V4 7/7] PM / Domains: Propagate performance state updates Viresh Kumar
2018-12-14 10:40 ` Ulf Hansson
2018-12-14 10:18 ` [PATCH V4 0/7] PM / Domains: Allow performance state propagation Rafael J. Wysocki
2018-12-14 10:19 ` Viresh Kumar
2018-12-14 18:05 ` Stephen Boyd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=184bbc28f982752cc040f0b9286516c3897e2808.1544782279.git.viresh.kumar@linaro.org \
--to=viresh.kumar@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=niklas.cassel@linaro.org \
--cc=nm@ti.com \
--cc=rjw@rjwysocki.net \
--cc=rnayak@codeaurora.org \
--cc=sboyd@kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=vincent.guittot@linaro.org \
--cc=vireshk@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).