Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1413251
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH V3 5/9] cpufreq: ia64: Use 'index' only to index into policy->freq_table |
| Date | 2016-06-03 15:40 +0200 |
| Message-ID | <rFXuq-3Iu-41@gated-at.bofh.it> (permalink) |
| References | <rFXup-3Iu-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 set
properly by the driver now.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/ia64-acpi-cpufreq.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/ia64-acpi-cpufreq.c b/drivers/cpufreq/ia64-acpi-cpufreq.c
index 759612da4fdc..cc8bb1e5ac50 100644
--- a/drivers/cpufreq/ia64-acpi-cpufreq.c
+++ b/drivers/cpufreq/ia64-acpi-cpufreq.c
@@ -210,7 +210,12 @@ acpi_cpufreq_target (
struct cpufreq_policy *policy,
unsigned int index)
{
- return processor_set_freq(acpi_io_data[policy->cpu], policy, index);
+ /*
+ * policy->freq_table may be sorted differently, get the index value we
+ * are concerned about.
+ */
+ return processor_set_freq(acpi_io_data[policy->cpu], policy,
+ policy->freq_table[index].driver_data);
}
static int
@@ -282,6 +287,8 @@ acpi_cpufreq_cpu_init (
} else {
freq_table[i].frequency = CPUFREQ_TABLE_END;
}
+
+ freq_table[i].driver_data = i;
}
result = cpufreq_table_validate_and_show(policy, freq_table);
--
2.7.1.410.g6faf27b
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH V3 0/9] cpufreq: Sort policy->freq_table Viresh Kumar <viresh.kumar@linaro.org> - 2016-06-03 15:40 +0200
[PATCH V3 5/9] cpufreq: ia64: Use 'index' only to index into policy->freq_table Viresh Kumar <viresh.kumar@linaro.org> - 2016-06-03 15:40 +0200
[PATCH V3 9/9] cpufreq: drivers: Free frequency tables after being used Viresh Kumar <viresh.kumar@linaro.org> - 2016-06-03 15:40 +0200
Re: [PATCH V3 9/9] cpufreq: drivers: Free frequency tables after being used "Rafael J. Wysocki" <rafael@kernel.org> - 2016-06-07 00:50 +0200
Re: [PATCH V3 0/9] cpufreq: Sort policy->freq_table "Rafael J. Wysocki" <rafael@kernel.org> - 2016-06-06 23:10 +0200
Re: [PATCH V3 0/9] cpufreq: Sort policy->freq_table Viresh Kumar <viresh.kumar@linaro.org> - 2016-06-07 05:50 +0200
csiph-web