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, Shawn Guo <shawn.guo@freescale.com>,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
Kevin Hilman <khilman@kernel.org>,
Krzysztof Kozlowski <k.kozlowski@samsung.com>,
Kukjin Kim <kgene@kernel.org>, Sekhar Nori <nsekhar@ti.com>,
Steven Miao <realmz6@gmail.com>
Subject: [PATCH 08/11] cpufreq: imx: Use 'index' only to index into policy->freq_table
Date: Thu, 2 Jun 2016 19:49:08 +0530 [thread overview]
Message-ID: <cbdf2d4b7dc59280f53191d892163a629fe8dba8.1464876460.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1464876460.git.viresh.kumar@linaro.org>
In-Reply-To: <cover.1464876460.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-02 14:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-02 14:19 [PATCH 00/11] cpufreq: Keep policy->freq_table sorted Viresh Kumar
2016-06-02 14:19 ` [PATCH 01/11] ARM: davinci: Sort frequency table Viresh Kumar
2016-06-02 14:19 ` [PATCH 02/11] cpufreq: davinci: Reuse cpufreq_generic_frequency_table_verify() Viresh Kumar
2016-06-02 14:19 ` [PATCH 03/11] cpufreq: Use policy->freq_table in ->target_index() Viresh Kumar
2016-06-02 14:19 ` [PATCH 04/11] cpufreq: blackfin: Use 'index' only to index into policy->freq_table Viresh Kumar
2016-06-02 14:19 ` [PATCH 05/11] cpufreq: elanfreq: " Viresh Kumar
2016-06-02 14:19 ` [PATCH 06/11] cpufreq: exynos: " Viresh Kumar
2016-06-02 14:19 ` [PATCH 07/11] cpufreq: ia64: " Viresh Kumar
2016-06-02 14:19 ` Viresh Kumar [this message]
2016-06-02 14:19 ` [PATCH 09/11] cpufreq: maple: " Viresh Kumar
2016-06-02 14:19 ` [PATCH 10/11] cpufreq: Keep a single (sorted) freq_table Viresh Kumar
2016-06-02 14:19 ` [PATCH 11/11] cpufreq: drivers: Free frequency tables after being used Viresh Kumar
2016-06-02 15:08 ` [PATCH 00/11] cpufreq: Keep policy->freq_table sorted Rafael J. Wysocki
2016-06-02 15:42 ` Viresh Kumar
2016-06-02 20:35 ` Rafael J. Wysocki
2016-06-03 0:01 ` Viresh Kumar
2016-06-03 1:43 ` Rafael J. Wysocki
2016-06-03 3:11 ` 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=cbdf2d4b7dc59280f53191d892163a629fe8dba8.1464876460.git.viresh.kumar@linaro.org \
--to=viresh.kumar@linaro.org \
--cc=dbaryshkov@gmail.com \
--cc=k.kozlowski@samsung.com \
--cc=kgene@kernel.org \
--cc=khilman@kernel.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=realmz6@gmail.com \
--cc=rjw@rjwysocki.net \
--cc=shawn.guo@freescale.com \
/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).