Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1413242 > unrolled thread
| Started by | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| First post | 2016-06-03 15:40 +0200 |
| Last post | 2016-06-06 06:00 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH V3 6/9] cpufreq: imx: Use 'index' only to index into policy->freq_table Viresh Kumar <viresh.kumar@linaro.org> - 2016-06-03 15:40 +0200
Re: [PATCH V3 6/9] cpufreq: imx: Use 'index' only to index into policy->freq_table Viresh Kumar <viresh.kumar@linaro.org> - 2016-06-06 06:00 +0200
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-06-03 15:40 +0200 |
| Subject | [PATCH V3 6/9] cpufreq: imx: Use 'index' only to index into policy->freq_table |
| Message-ID | <rFXuq-3Iu-29@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-06-06 06:00 +0200 |
| Subject | Re: [PATCH V3 6/9] cpufreq: imx: Use 'index' only to index into policy->freq_table |
| Message-ID | <rGTRM-7TG-7@gated-at.bofh.it> |
| In reply to | #1413242 |
On 03-06-16, 19:05, Viresh Kumar wrote: > 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(-) Fixing Shawn's id. -- viresh
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web