From: Viresh Kumar <viresh.kumar@linaro.org>
To: Rafael Wysocki <rjw@rjwysocki.net>,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, steve.muckle@linaro.org,
Shawn Guo <shawn.guo@freescale.com>,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
Krzysztof Kozlowski <k.kozlowski@samsung.com>,
Kukjin Kim <kgene@kernel.org>, Steven Miao <realmz6@gmail.com>
Subject: [PATCH V3 6/9] cpufreq: imx: Use 'index' only to index into policy->freq_table
Date: Fri, 3 Jun 2016 19:05:12 +0530 [thread overview]
Message-ID: <5be64daa9fc2967351f7e5949b814d866264598e.1464960877.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1464960877.git.viresh.kumar@linaro.org>
In-Reply-To: <cover.1464960877.git.viresh.kumar@linaro.org>
Later patches would make changes in cpufreq core, after which
policy->freq_table may be reordered by cpufreq core and it wouldn't be
safe anymore to use 'index' for any other local arrays.
To prepare for that, use policy->freq_table[index].driver_data for other
driver specific usage of 'index'. The 'driver_data' fields are already
set properly by the driver.
Cc: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/imx6q-cpufreq.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index 3858dc7e617b..e7da85890e8c 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -42,14 +42,21 @@ static unsigned int transition_latency;
static u32 *imx6_soc_volt;
static u32 soc_opp_count;
-static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
+static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int pindex)
{
struct dev_pm_opp *opp;
unsigned long freq_hz, volt, volt_old;
- unsigned int old_freq, new_freq;
+ unsigned int old_freq, new_freq, index;
int ret;
- new_freq = policy->freq_table[index].frequency;
+ new_freq = policy->freq_table[pindex].frequency;
+
+ /*
+ * policy->freq_table may be sorted differently, get the index value we
+ * are concerned about.
+ */
+ index = policy->freq_table[pindex].driver_data;
+
freq_hz = new_freq * 1000;
old_freq = clk_get_rate(arm_clk) / 1000;
--
2.7.1.410.g6faf27b
next prev parent reply other threads:[~2016-06-03 13:35 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-03 13:35 [PATCH V3 0/9] cpufreq: Sort policy->freq_table Viresh Kumar
2016-06-03 13:35 ` [PATCH V3 1/9] cpufreq: Use policy->freq_table in ->target_index() Viresh Kumar
2016-06-03 13:35 ` [PATCH V3 2/9] cpufreq: blackfin: Use 'index' only to index into policy->freq_table Viresh Kumar
2016-06-03 13:35 ` [PATCH V3 3/9] cpufreq: elanfreq: " Viresh Kumar
2016-06-03 13:35 ` [PATCH V3 4/9] cpufreq: exynos: " Viresh Kumar
2016-06-06 7:07 ` Krzysztof Kozlowski
2016-06-03 13:35 ` [PATCH V3 5/9] cpufreq: ia64: " Viresh Kumar
2016-06-03 13:35 ` Viresh Kumar [this message]
2016-06-06 3:58 ` [PATCH V3 6/9] cpufreq: imx: " Viresh Kumar
2016-06-03 13:35 ` [PATCH V3 7/9] cpufreq: maple: " Viresh Kumar
2016-06-03 13:35 ` [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in ascending order Viresh Kumar
2016-06-03 23:48 ` Steve Muckle
2016-06-06 3:52 ` Viresh Kumar
2016-06-06 12:10 ` Rafael J. Wysocki
2016-06-06 12:24 ` Viresh Kumar
2016-06-06 12:57 ` Rafael J. Wysocki
2016-06-06 16:25 ` Viresh Kumar
2016-06-06 21:56 ` Rafael J. Wysocki
2016-06-07 4:28 ` Viresh Kumar
2016-06-08 0:38 ` Rafael J. Wysocki
2016-06-08 3:48 ` Viresh Kumar
2016-06-03 13:35 ` [PATCH V3 9/9] cpufreq: drivers: Free frequency tables after being used Viresh Kumar
2016-06-06 22:45 ` Rafael J. Wysocki
2016-06-06 21:09 ` [PATCH V3 0/9] cpufreq: Sort policy->freq_table Rafael J. Wysocki
2016-06-07 3:48 ` 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=5be64daa9fc2967351f7e5949b814d866264598e.1464960877.git.viresh.kumar@linaro.org \
--to=viresh.kumar@linaro.org \
--cc=dbaryshkov@gmail.com \
--cc=k.kozlowski@samsung.com \
--cc=kgene@kernel.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=realmz6@gmail.com \
--cc=rjw@rjwysocki.net \
--cc=shawn.guo@freescale.com \
--cc=steve.muckle@linaro.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).