linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: aisheng.dong@nxp.com (Dong Aisheng)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/7] PM / OPP: rename opp_table->clk to opp_table->cur_clk
Date: Thu, 24 Aug 2017 00:10:06 +0800	[thread overview]
Message-ID: <1503504610-12880-4-git-send-email-aisheng.dong@nxp.com> (raw)
In-Reply-To: <1503504610-12880-1-git-send-email-aisheng.dong@nxp.com>

Since we now support per OPP clocks, we rename opp_table->clk to
opp_table->cur_clk to make it less confusing as the opp_table->clk
will become only represent the current clock of the current OPP
on which the device is running.

Cc: Viresh Kumar <vireshk@kernel.org>
Cc: Nishanth Menon <nm@ti.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 drivers/base/power/opp/core.c | 30 +++++++++++++++---------------
 drivers/base/power/opp/opp.h  |  4 ++--
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index 37cf970..2579401 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -527,9 +527,9 @@ _generic_set_opp_clk_only(const struct opp_table *opp_table, struct device *dev,
 	int ret;
 
 	if (opp_table->set_clk)
-		return opp_table->set_clk(dev, opp_table->clk, old_freq, freq);
+		return opp_table->set_clk(dev, opp_table->cur_clk, old_freq, freq);
 
-	ret = clk_set_rate(opp_table->clk, freq);
+	ret = clk_set_rate(opp_table->cur_clk, freq);
 	if (ret) {
 		dev_err(dev, "%s: failed to set clock rate: %d\n", __func__,
 			ret);
@@ -615,7 +615,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
 		return PTR_ERR(opp_table);
 	}
 
-	clk = opp_table->clk;
+	clk = opp_table->cur_clk;
 	if (IS_ERR(clk)) {
 		dev_err(dev, "%s: No clock available for the device\n",
 			__func__);
@@ -750,9 +750,9 @@ static struct opp_table *_allocate_opp_table(struct device *dev)
 	_of_init_opp_table(opp_table, dev);
 
 	/* Find clk for the device */
-	opp_table->clk = clk_get(dev, NULL);
-	if (IS_ERR(opp_table->clk)) {
-		ret = PTR_ERR(opp_table->clk);
+	opp_table->cur_clk = clk_get(dev, NULL);
+	if (IS_ERR(opp_table->cur_clk)) {
+		ret = PTR_ERR(opp_table->cur_clk);
 		if (ret != -EPROBE_DEFER)
 			dev_dbg(dev, "%s: Couldn't find clock: %d\n", __func__,
 				ret);
@@ -799,8 +799,8 @@ static void _opp_table_kref_release(struct kref *kref)
 	struct opp_device *opp_dev;
 
 	/* Release clk */
-	if (!IS_ERR(opp_table->clk))
-		clk_put(opp_table->clk);
+	if (!IS_ERR(opp_table->cur_clk))
+		clk_put(opp_table->cur_clk);
 
 	opp_dev = list_first_entry(&opp_table->dev_list, struct opp_device,
 				   node);
@@ -1393,13 +1393,13 @@ struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name)
 	}
 
 	/* Already have default clk set, free it */
-	if (!IS_ERR(opp_table->clk))
-		clk_put(opp_table->clk);
+	if (!IS_ERR(opp_table->cur_clk))
+		clk_put(opp_table->cur_clk);
 
 	/* Find clk for the device */
-	opp_table->clk = clk_get(dev, name);
-	if (IS_ERR(opp_table->clk)) {
-		ret = PTR_ERR(opp_table->clk);
+	opp_table->cur_clk = clk_get(dev, name);
+	if (IS_ERR(opp_table->cur_clk)) {
+		ret = PTR_ERR(opp_table->cur_clk);
 		if (ret != -EPROBE_DEFER) {
 			dev_err(dev, "%s: Couldn't find clock: %d\n", __func__,
 				ret);
@@ -1425,8 +1425,8 @@ void dev_pm_opp_put_clkname(struct opp_table *opp_table)
 	/* Make sure there are no concurrent readers while updating opp_table */
 	WARN_ON(!list_empty(&opp_table->opp_list));
 
-	clk_put(opp_table->clk);
-	opp_table->clk = ERR_PTR(-EINVAL);
+	clk_put(opp_table->cur_clk);
+	opp_table->cur_clk = ERR_PTR(-EINVAL);
 
 	dev_pm_opp_put_opp_table(opp_table);
 }
diff --git a/drivers/base/power/opp/opp.h b/drivers/base/power/opp/opp.h
index c85405e..30a637c 100644
--- a/drivers/base/power/opp/opp.h
+++ b/drivers/base/power/opp/opp.h
@@ -132,7 +132,7 @@ enum opp_table_access {
  * @supported_hw: Array of version number to support.
  * @supported_hw_count: Number of elements in supported_hw array.
  * @prop_name: A name to postfix to many DT properties, while parsing them.
- * @clk: Device's clock handle
+ * @cur_clk: Current device's clock handle
  * @regulators: Supply regulators
  * @regulator_count: Number of power supply regulators
  * @set_opp: Platform specific set_opp callback
@@ -169,7 +169,7 @@ struct opp_table {
 	unsigned int *supported_hw;
 	unsigned int supported_hw_count;
 	const char *prop_name;
-	struct clk *clk;
+	struct clk *cur_clk;
 	struct regulator **regulators;
 	unsigned int regulator_count;
 
-- 
2.7.4

  parent reply	other threads:[~2017-08-23 16:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23 16:10 [PATCH 0/7] PM / OPP: per OPP node clock support and imx7ulp cpufreq driver Dong Aisheng
2017-08-23 16:10 ` [PATCH 1/7] PM / OPP: Add platform specific set_clk function Dong Aisheng
2017-09-19 22:58   ` Viresh Kumar
2017-09-20  7:03     ` Dong Aisheng
2017-09-20 20:30       ` Viresh Kumar
2017-09-21  2:17         ` A.s. Dong
2017-08-23 16:10 ` [PATCH 2/7] dt-bindings: PM / OPP: add clocks per OPP node support Dong Aisheng
2017-08-31 17:39   ` Rob Herring
2017-09-01 13:01     ` Dong Aisheng
2017-08-23 16:10 ` Dong Aisheng [this message]
2017-08-23 16:10 ` [PATCH 4/7] PM / OPP: use OPP node clock to set CPU frequency Dong Aisheng
2017-08-23 16:10 ` [PATCH 5/7] PM / OPP: Add dev_pm_opp_get_cur_clk() Dong Aisheng
2017-08-23 16:10 ` [PATCH 6/7] cpufreq: make cpufreq_generic_init transition_latency default to CPUFREQ_ETERNAL Dong Aisheng
2017-09-19 23:10   ` Viresh Kumar
2017-09-20  7:04     ` Dong Aisheng
2017-09-20 14:45       ` Viresh Kumar
2017-08-23 16:10 ` [PATCH 7/7] cpufreq: add imx7ulp cpufreq driver Dong Aisheng
2017-09-11  7:28 ` [PATCH 0/7] PM / OPP: per OPP node clock support and " Dong Aisheng
2017-09-19 22:54   ` Viresh Kumar

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=1503504610-12880-4-git-send-email-aisheng.dong@nxp.com \
    --to=aisheng.dong@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.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).