diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-05-08 07:06:38 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-05-08 07:06:38 -0400 |
commit | 37c147948742d34bdc3d9b491f99c77fc48daac0 (patch) | |
tree | c2481b8485e5c47af10114a97ebf5ade616ee285 /drivers/cpufreq | |
parent | 89ca3b881987f5a4be4c5dbaa7f0df12bbdde2fd (diff) | |
parent | a0dd7b79657bd6644b914d16ce7f23468c44a7b4 (diff) |
Merge back earlier 'pm-cpufreq' material.
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/Kconfig.arm | 4 | ||||
-rw-r--r-- | drivers/cpufreq/Kconfig.x86 | 4 | ||||
-rw-r--r-- | drivers/cpufreq/Makefile | 2 | ||||
-rw-r--r-- | drivers/cpufreq/acpi-cpufreq.c | 9 | ||||
-rw-r--r-- | drivers/cpufreq/arm_big_little.c | 16 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 25 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_opp.c | 110 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 24 | ||||
-rw-r--r-- | drivers/cpufreq/dbx500-cpufreq.c | 8 | ||||
-rw-r--r-- | drivers/cpufreq/elanfreq.c | 9 | ||||
-rw-r--r-- | drivers/cpufreq/exynos-cpufreq.c | 32 | ||||
-rw-r--r-- | drivers/cpufreq/exynos-cpufreq.h | 1 | ||||
-rw-r--r-- | drivers/cpufreq/exynos5440-cpufreq.c | 30 | ||||
-rw-r--r-- | drivers/cpufreq/freq_table.c | 56 | ||||
-rw-r--r-- | drivers/cpufreq/intel_pstate.c | 11 | ||||
-rw-r--r-- | drivers/cpufreq/longhaul.c | 11 | ||||
-rw-r--r-- | drivers/cpufreq/pasemi-cpufreq.c | 10 | ||||
-rw-r--r-- | drivers/cpufreq/powernow-k6.c | 14 | ||||
-rw-r--r-- | drivers/cpufreq/ppc_cbe_cpufreq.c | 9 | ||||
-rw-r--r-- | drivers/cpufreq/s3c2416-cpufreq.c | 40 | ||||
-rw-r--r-- | drivers/cpufreq/s3c64xx-cpufreq.c | 15 | ||||
-rw-r--r-- | drivers/cpufreq/speedstep-centrino.c | 2 |
22 files changed, 275 insertions, 167 deletions
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 580503513f0f..6e05a1e18e52 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
@@ -85,7 +85,7 @@ config ARM_EXYNOS_CPU_FREQ_BOOST_SW | |||
85 | It allows usage of special frequencies for Samsung Exynos | 85 | It allows usage of special frequencies for Samsung Exynos |
86 | processors if thermal conditions are appropriate. | 86 | processors if thermal conditions are appropriate. |
87 | 87 | ||
88 | It reguires, for safe operation, thermal framework with properly | 88 | It requires, for safe operation, thermal framework with properly |
89 | defined trip points. | 89 | defined trip points. |
90 | 90 | ||
91 | If in doubt, say N. | 91 | If in doubt, say N. |
@@ -186,7 +186,7 @@ config ARM_S3C2416_CPUFREQ | |||
186 | S3C2450 SoC. The S3C2416 supports changing the rate of the | 186 | S3C2450 SoC. The S3C2416 supports changing the rate of the |
187 | armdiv clock source and also entering a so called dynamic | 187 | armdiv clock source and also entering a so called dynamic |
188 | voltage scaling mode in which it is possible to reduce the | 188 | voltage scaling mode in which it is possible to reduce the |
189 | core voltage of the cpu. | 189 | core voltage of the CPU. |
190 | 190 | ||
191 | If in doubt, say N. | 191 | If in doubt, say N. |
192 | 192 | ||
diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86 index d369349eeaab..89ae88f91895 100644 --- a/drivers/cpufreq/Kconfig.x86 +++ b/drivers/cpufreq/Kconfig.x86 | |||
@@ -10,7 +10,7 @@ config X86_INTEL_PSTATE | |||
10 | The driver implements an internal governor and will become | 10 | The driver implements an internal governor and will become |
11 | the scaling driver and governor for Sandy bridge processors. | 11 | the scaling driver and governor for Sandy bridge processors. |
12 | 12 | ||
13 | When this driver is enabled it will become the perferred | 13 | When this driver is enabled it will become the preferred |
14 | scaling driver for Sandy bridge processors. | 14 | scaling driver for Sandy bridge processors. |
15 | 15 | ||
16 | If in doubt, say N. | 16 | If in doubt, say N. |
@@ -52,7 +52,7 @@ config X86_ACPI_CPUFREQ_CPB | |||
52 | help | 52 | help |
53 | The powernow-k8 driver used to provide a sysfs knob called "cpb" | 53 | The powernow-k8 driver used to provide a sysfs knob called "cpb" |
54 | to disable the Core Performance Boosting feature of AMD CPUs. This | 54 | to disable the Core Performance Boosting feature of AMD CPUs. This |
55 | file has now been superseeded by the more generic "boost" entry. | 55 | file has now been superseded by the more generic "boost" entry. |
56 | 56 | ||
57 | By enabling this option the acpi_cpufreq driver provides the old | 57 | By enabling this option the acpi_cpufreq driver provides the old |
58 | entry in addition to the new boost ones, for compatibility reasons. | 58 | entry in addition to the new boost ones, for compatibility reasons. |
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index 0dbb963c1aef..738c8b7b17dc 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile | |||
@@ -1,5 +1,7 @@ | |||
1 | # CPUfreq core | 1 | # CPUfreq core |
2 | obj-$(CONFIG_CPU_FREQ) += cpufreq.o freq_table.o | 2 | obj-$(CONFIG_CPU_FREQ) += cpufreq.o freq_table.o |
3 | obj-$(CONFIG_PM_OPP) += cpufreq_opp.o | ||
4 | |||
3 | # CPUfreq stats | 5 | # CPUfreq stats |
4 | obj-$(CONFIG_CPU_FREQ_STAT) += cpufreq_stats.o | 6 | obj-$(CONFIG_CPU_FREQ_STAT) += cpufreq_stats.o |
5 | 7 | ||
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 000e4e0afd7e..b0c18ed8d83f 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c | |||
@@ -213,7 +213,7 @@ static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data) | |||
213 | 213 | ||
214 | static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data) | 214 | static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data) |
215 | { | 215 | { |
216 | int i; | 216 | struct cpufreq_frequency_table *pos; |
217 | struct acpi_processor_performance *perf; | 217 | struct acpi_processor_performance *perf; |
218 | 218 | ||
219 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) | 219 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) |
@@ -223,10 +223,9 @@ static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data) | |||
223 | 223 | ||
224 | perf = data->acpi_data; | 224 | perf = data->acpi_data; |
225 | 225 | ||
226 | for (i = 0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { | 226 | cpufreq_for_each_entry(pos, data->freq_table) |
227 | if (msr == perf->states[data->freq_table[i].driver_data].status) | 227 | if (msr == perf->states[pos->driver_data].status) |
228 | return data->freq_table[i].frequency; | 228 | return pos->frequency; |
229 | } | ||
230 | return data->freq_table[0].frequency; | 229 | return data->freq_table[0].frequency; |
231 | } | 230 | } |
232 | 231 | ||
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c index bad2ed317ba2..1f4d4e315057 100644 --- a/drivers/cpufreq/arm_big_little.c +++ b/drivers/cpufreq/arm_big_little.c | |||
@@ -226,22 +226,22 @@ static inline u32 get_table_count(struct cpufreq_frequency_table *table) | |||
226 | /* get the minimum frequency in the cpufreq_frequency_table */ | 226 | /* get the minimum frequency in the cpufreq_frequency_table */ |
227 | static inline u32 get_table_min(struct cpufreq_frequency_table *table) | 227 | static inline u32 get_table_min(struct cpufreq_frequency_table *table) |
228 | { | 228 | { |
229 | int i; | 229 | struct cpufreq_frequency_table *pos; |
230 | uint32_t min_freq = ~0; | 230 | uint32_t min_freq = ~0; |
231 | for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) | 231 | cpufreq_for_each_entry(pos, table) |
232 | if (table[i].frequency < min_freq) | 232 | if (pos->frequency < min_freq) |
233 | min_freq = table[i].frequency; | 233 | min_freq = pos->frequency; |
234 | return min_freq; | 234 | return min_freq; |
235 | } | 235 | } |
236 | 236 | ||
237 | /* get the maximum frequency in the cpufreq_frequency_table */ | 237 | /* get the maximum frequency in the cpufreq_frequency_table */ |
238 | static inline u32 get_table_max(struct cpufreq_frequency_table *table) | 238 | static inline u32 get_table_max(struct cpufreq_frequency_table *table) |
239 | { | 239 | { |
240 | int i; | 240 | struct cpufreq_frequency_table *pos; |
241 | uint32_t max_freq = 0; | 241 | uint32_t max_freq = 0; |
242 | for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) | 242 | cpufreq_for_each_entry(pos, table) |
243 | if (table[i].frequency > max_freq) | 243 | if (pos->frequency > max_freq) |
244 | max_freq = table[i].frequency; | 244 | max_freq = pos->frequency; |
245 | return max_freq; | 245 | return max_freq; |
246 | } | 246 | } |
247 | 247 | ||
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index abda6609d3e7..bfe82b63875f 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -237,6 +237,17 @@ void cpufreq_cpu_put(struct cpufreq_policy *policy) | |||
237 | } | 237 | } |
238 | EXPORT_SYMBOL_GPL(cpufreq_cpu_put); | 238 | EXPORT_SYMBOL_GPL(cpufreq_cpu_put); |
239 | 239 | ||
240 | bool cpufreq_next_valid(struct cpufreq_frequency_table **pos) | ||
241 | { | ||
242 | while ((*pos)->frequency != CPUFREQ_TABLE_END) | ||
243 | if ((*pos)->frequency != CPUFREQ_ENTRY_INVALID) | ||
244 | return true; | ||
245 | else | ||
246 | (*pos)++; | ||
247 | return false; | ||
248 | } | ||
249 | EXPORT_SYMBOL_GPL(cpufreq_next_valid); | ||
250 | |||
240 | /********************************************************************* | 251 | /********************************************************************* |
241 | * EXTERNALLY AFFECTING FREQUENCY CHANGES * | 252 | * EXTERNALLY AFFECTING FREQUENCY CHANGES * |
242 | *********************************************************************/ | 253 | *********************************************************************/ |
@@ -354,6 +365,18 @@ static void cpufreq_notify_post_transition(struct cpufreq_policy *policy, | |||
354 | void cpufreq_freq_transition_begin(struct cpufreq_policy *policy, | 365 | void cpufreq_freq_transition_begin(struct cpufreq_policy *policy, |
355 | struct cpufreq_freqs *freqs) | 366 | struct cpufreq_freqs *freqs) |
356 | { | 367 | { |
368 | |||
369 | /* | ||
370 | * Catch double invocations of _begin() which lead to self-deadlock. | ||
371 | * ASYNC_NOTIFICATION drivers are left out because the cpufreq core | ||
372 | * doesn't invoke _begin() on their behalf, and hence the chances of | ||
373 | * double invocations are very low. Moreover, there are scenarios | ||
374 | * where these checks can emit false-positive warnings in these | ||
375 | * drivers; so we avoid that by skipping them altogether. | ||
376 | */ | ||
377 | WARN_ON(!(cpufreq_driver->flags & CPUFREQ_ASYNC_NOTIFICATION) | ||
378 | && current == policy->transition_task); | ||
379 | |||
357 | wait: | 380 | wait: |
358 | wait_event(policy->transition_wait, !policy->transition_ongoing); | 381 | wait_event(policy->transition_wait, !policy->transition_ongoing); |
359 | 382 | ||
@@ -365,6 +388,7 @@ wait: | |||
365 | } | 388 | } |
366 | 389 | ||
367 | policy->transition_ongoing = true; | 390 | policy->transition_ongoing = true; |
391 | policy->transition_task = current; | ||
368 | 392 | ||
369 | spin_unlock(&policy->transition_lock); | 393 | spin_unlock(&policy->transition_lock); |
370 | 394 | ||
@@ -381,6 +405,7 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy, | |||
381 | cpufreq_notify_post_transition(policy, freqs, transition_failed); | 405 | cpufreq_notify_post_transition(policy, freqs, transition_failed); |
382 | 406 | ||
383 | policy->transition_ongoing = false; | 407 | policy->transition_ongoing = false; |
408 | policy->transition_task = NULL; | ||
384 | 409 | ||
385 | wake_up(&policy->transition_wait); | 410 | wake_up(&policy->transition_wait); |
386 | } | 411 | } |
diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c new file mode 100644 index 000000000000..c0c6f4a4eccf --- /dev/null +++ b/drivers/cpufreq/cpufreq_opp.c | |||
@@ -0,0 +1,110 @@ | |||
1 | /* | ||
2 | * Generic OPP helper interface for CPUFreq drivers | ||
3 | * | ||
4 | * Copyright (C) 2009-2014 Texas Instruments Incorporated. | ||
5 | * Nishanth Menon | ||
6 | * Romit Dasgupta | ||
7 | * Kevin Hilman | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | #include <linux/cpufreq.h> | ||
14 | #include <linux/device.h> | ||
15 | #include <linux/err.h> | ||
16 | #include <linux/errno.h> | ||
17 | #include <linux/export.h> | ||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/pm_opp.h> | ||
20 | #include <linux/rcupdate.h> | ||
21 | #include <linux/slab.h> | ||
22 | |||
23 | /** | ||
24 | * dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a device | ||
25 | * @dev: device for which we do this operation | ||
26 | * @table: Cpufreq table returned back to caller | ||
27 | * | ||
28 | * Generate a cpufreq table for a provided device- this assumes that the | ||
29 | * opp list is already initialized and ready for usage. | ||
30 | * | ||
31 | * This function allocates required memory for the cpufreq table. It is | ||
32 | * expected that the caller does the required maintenance such as freeing | ||
33 | * the table as required. | ||
34 | * | ||
35 | * Returns -EINVAL for bad pointers, -ENODEV if the device is not found, -ENOMEM | ||
36 | * if no memory available for the operation (table is not populated), returns 0 | ||
37 | * if successful and table is populated. | ||
38 | * | ||
39 | * WARNING: It is important for the callers to ensure refreshing their copy of | ||
40 | * the table if any of the mentioned functions have been invoked in the interim. | ||
41 | * | ||
42 | * Locking: The internal device_opp and opp structures are RCU protected. | ||
43 | * Since we just use the regular accessor functions to access the internal data | ||
44 | * structures, we use RCU read lock inside this function. As a result, users of | ||
45 | * this function DONOT need to use explicit locks for invoking. | ||
46 | */ | ||
47 | int dev_pm_opp_init_cpufreq_table(struct device *dev, | ||
48 | struct cpufreq_frequency_table **table) | ||
49 | { | ||
50 | struct dev_pm_opp *opp; | ||
51 | struct cpufreq_frequency_table *freq_table = NULL; | ||
52 | int i, max_opps, ret = 0; | ||
53 | unsigned long rate; | ||
54 | |||
55 | rcu_read_lock(); | ||
56 | |||
57 | max_opps = dev_pm_opp_get_opp_count(dev); | ||
58 | if (max_opps <= 0) { | ||
59 | ret = max_opps ? max_opps : -ENODATA; | ||
60 | goto out; | ||
61 | } | ||
62 | |||
63 | freq_table = kzalloc(sizeof(*freq_table) * (max_opps + 1), GFP_KERNEL); | ||
64 | if (!freq_table) { | ||
65 | ret = -ENOMEM; | ||
66 | goto out; | ||
67 | } | ||
68 | |||
69 | for (i = 0, rate = 0; i < max_opps; i++, rate++) { | ||
70 | /* find next rate */ | ||
71 | opp = dev_pm_opp_find_freq_ceil(dev, &rate); | ||
72 | if (IS_ERR(opp)) { | ||
73 | ret = PTR_ERR(opp); | ||
74 | goto out; | ||
75 | } | ||
76 | freq_table[i].driver_data = i; | ||
77 | freq_table[i].frequency = rate / 1000; | ||
78 | } | ||
79 | |||
80 | freq_table[i].driver_data = i; | ||
81 | freq_table[i].frequency = CPUFREQ_TABLE_END; | ||
82 | |||
83 | *table = &freq_table[0]; | ||
84 | |||
85 | out: | ||
86 | rcu_read_unlock(); | ||
87 | if (ret) | ||
88 | kfree(freq_table); | ||
89 | |||
90 | return ret; | ||
91 | } | ||
92 | EXPORT_SYMBOL_GPL(dev_pm_opp_init_cpufreq_table); | ||
93 | |||
94 | /** | ||
95 | * dev_pm_opp_free_cpufreq_table() - free the cpufreq table | ||
96 | * @dev: device for which we do this operation | ||
97 | * @table: table to free | ||
98 | * | ||
99 | * Free up the table allocated by dev_pm_opp_init_cpufreq_table | ||
100 | */ | ||
101 | void dev_pm_opp_free_cpufreq_table(struct device *dev, | ||
102 | struct cpufreq_frequency_table **table) | ||
103 | { | ||
104 | if (!table) | ||
105 | return; | ||
106 | |||
107 | kfree(*table); | ||
108 | *table = NULL; | ||
109 | } | ||
110 | EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table); | ||
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index ecaaebf969fc..0cd9b4dcef99 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -182,11 +182,11 @@ static void cpufreq_stats_free_table(unsigned int cpu) | |||
182 | 182 | ||
183 | static int __cpufreq_stats_create_table(struct cpufreq_policy *policy) | 183 | static int __cpufreq_stats_create_table(struct cpufreq_policy *policy) |
184 | { | 184 | { |
185 | unsigned int i, j, count = 0, ret = 0; | 185 | unsigned int i, count = 0, ret = 0; |
186 | struct cpufreq_stats *stat; | 186 | struct cpufreq_stats *stat; |
187 | unsigned int alloc_size; | 187 | unsigned int alloc_size; |
188 | unsigned int cpu = policy->cpu; | 188 | unsigned int cpu = policy->cpu; |
189 | struct cpufreq_frequency_table *table; | 189 | struct cpufreq_frequency_table *pos, *table; |
190 | 190 | ||
191 | table = cpufreq_frequency_get_table(cpu); | 191 | table = cpufreq_frequency_get_table(cpu); |
192 | if (unlikely(!table)) | 192 | if (unlikely(!table)) |
@@ -205,12 +205,8 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy) | |||
205 | stat->cpu = cpu; | 205 | stat->cpu = cpu; |
206 | per_cpu(cpufreq_stats_table, cpu) = stat; | 206 | per_cpu(cpufreq_stats_table, cpu) = stat; |
207 | 207 | ||
208 | for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) { | 208 | cpufreq_for_each_valid_entry(pos, table) |
209 | unsigned int freq = table[i].frequency; | ||
210 | if (freq == CPUFREQ_ENTRY_INVALID) | ||
211 | continue; | ||
212 | count++; | 209 | count++; |
213 | } | ||
214 | 210 | ||
215 | alloc_size = count * sizeof(int) + count * sizeof(u64); | 211 | alloc_size = count * sizeof(int) + count * sizeof(u64); |
216 | 212 | ||
@@ -228,15 +224,11 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy) | |||
228 | #ifdef CONFIG_CPU_FREQ_STAT_DETAILS | 224 | #ifdef CONFIG_CPU_FREQ_STAT_DETAILS |
229 | stat->trans_table = stat->freq_table + count; | 225 | stat->trans_table = stat->freq_table + count; |
230 | #endif | 226 | #endif |
231 | j = 0; | 227 | i = 0; |
232 | for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) { | 228 | cpufreq_for_each_valid_entry(pos, table) |
233 | unsigned int freq = table[i].frequency; | 229 | if (freq_table_get_index(stat, pos->frequency) == -1) |
234 | if (freq == CPUFREQ_ENTRY_INVALID) | 230 | stat->freq_table[i++] = pos->frequency; |
235 | continue; | 231 | stat->state_num = i; |
236 | if (freq_table_get_index(stat, freq) == -1) | ||
237 | stat->freq_table[j++] = freq; | ||
238 | } | ||
239 | stat->state_num = j; | ||
240 | spin_lock(&cpufreq_stats_lock); | 232 | spin_lock(&cpufreq_stats_lock); |
241 | stat->last_time = get_jiffies_64(); | 233 | stat->last_time = get_jiffies_64(); |
242 | stat->last_index = freq_table_get_index(stat, policy->cur); | 234 | stat->last_index = freq_table_get_index(stat, policy->cur); |
diff --git a/drivers/cpufreq/dbx500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c index 412a78bb0c94..4bebc1b5db48 100644 --- a/drivers/cpufreq/dbx500-cpufreq.c +++ b/drivers/cpufreq/dbx500-cpufreq.c | |||
@@ -45,7 +45,7 @@ static struct cpufreq_driver dbx500_cpufreq_driver = { | |||
45 | 45 | ||
46 | static int dbx500_cpufreq_probe(struct platform_device *pdev) | 46 | static int dbx500_cpufreq_probe(struct platform_device *pdev) |
47 | { | 47 | { |
48 | int i = 0; | 48 | struct cpufreq_frequency_table *pos; |
49 | 49 | ||
50 | freq_table = dev_get_platdata(&pdev->dev); | 50 | freq_table = dev_get_platdata(&pdev->dev); |
51 | if (!freq_table) { | 51 | if (!freq_table) { |
@@ -60,10 +60,8 @@ static int dbx500_cpufreq_probe(struct platform_device *pdev) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | pr_info("dbx500-cpufreq: Available frequencies:\n"); | 62 | pr_info("dbx500-cpufreq: Available frequencies:\n"); |
63 | while (freq_table[i].frequency != CPUFREQ_TABLE_END) { | 63 | cpufreq_for_each_entry(pos, freq_table) |
64 | pr_info(" %d Mhz\n", freq_table[i].frequency/1000); | 64 | pr_info(" %d Mhz\n", pos->frequency / 1000); |
65 | i++; | ||
66 | } | ||
67 | 65 | ||
68 | return cpufreq_register_driver(&dbx500_cpufreq_driver); | 66 | return cpufreq_register_driver(&dbx500_cpufreq_driver); |
69 | } | 67 | } |
diff --git a/drivers/cpufreq/elanfreq.c b/drivers/cpufreq/elanfreq.c index 7f5d2a68c353..1c06e786c9ba 100644 --- a/drivers/cpufreq/elanfreq.c +++ b/drivers/cpufreq/elanfreq.c | |||
@@ -147,7 +147,7 @@ static int elanfreq_target(struct cpufreq_policy *policy, | |||
147 | static int elanfreq_cpu_init(struct cpufreq_policy *policy) | 147 | static int elanfreq_cpu_init(struct cpufreq_policy *policy) |
148 | { | 148 | { |
149 | struct cpuinfo_x86 *c = &cpu_data(0); | 149 | struct cpuinfo_x86 *c = &cpu_data(0); |
150 | unsigned int i; | 150 | struct cpufreq_frequency_table *pos; |
151 | 151 | ||
152 | /* capability check */ | 152 | /* capability check */ |
153 | if ((c->x86_vendor != X86_VENDOR_AMD) || | 153 | if ((c->x86_vendor != X86_VENDOR_AMD) || |
@@ -159,10 +159,9 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy) | |||
159 | max_freq = elanfreq_get_cpu_frequency(0); | 159 | max_freq = elanfreq_get_cpu_frequency(0); |
160 | 160 | ||
161 | /* table init */ | 161 | /* table init */ |
162 | for (i = 0; (elanfreq_table[i].frequency != CPUFREQ_TABLE_END); i++) { | 162 | cpufreq_for_each_entry(pos, elanfreq_table) |
163 | if (elanfreq_table[i].frequency > max_freq) | 163 | if (pos->frequency > max_freq) |
164 | elanfreq_table[i].frequency = CPUFREQ_ENTRY_INVALID; | 164 | pos->frequency = CPUFREQ_ENTRY_INVALID; |
165 | } | ||
166 | 165 | ||
167 | /* cpuinfo and default policy values */ | 166 | /* cpuinfo and default policy values */ |
168 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 167 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index f99cfe24e7bc..c3e55aa28cf8 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c | |||
@@ -29,17 +29,16 @@ static unsigned int locking_frequency; | |||
29 | static int exynos_cpufreq_get_index(unsigned int freq) | 29 | static int exynos_cpufreq_get_index(unsigned int freq) |
30 | { | 30 | { |
31 | struct cpufreq_frequency_table *freq_table = exynos_info->freq_table; | 31 | struct cpufreq_frequency_table *freq_table = exynos_info->freq_table; |
32 | int index; | 32 | struct cpufreq_frequency_table *pos; |
33 | 33 | ||
34 | for (index = 0; | 34 | cpufreq_for_each_entry(pos, freq_table) |
35 | freq_table[index].frequency != CPUFREQ_TABLE_END; index++) | 35 | if (pos->frequency == freq) |
36 | if (freq_table[index].frequency == freq) | ||
37 | break; | 36 | break; |
38 | 37 | ||
39 | if (freq_table[index].frequency == CPUFREQ_TABLE_END) | 38 | if (pos->frequency == CPUFREQ_TABLE_END) |
40 | return -EINVAL; | 39 | return -EINVAL; |
41 | 40 | ||
42 | return index; | 41 | return pos - freq_table; |
43 | } | 42 | } |
44 | 43 | ||
45 | static int exynos_cpufreq_scale(unsigned int target_freq) | 44 | static int exynos_cpufreq_scale(unsigned int target_freq) |
@@ -49,6 +48,7 @@ static int exynos_cpufreq_scale(unsigned int target_freq) | |||
49 | struct cpufreq_policy *policy = cpufreq_cpu_get(0); | 48 | struct cpufreq_policy *policy = cpufreq_cpu_get(0); |
50 | unsigned int arm_volt, safe_arm_volt = 0; | 49 | unsigned int arm_volt, safe_arm_volt = 0; |
51 | unsigned int mpll_freq_khz = exynos_info->mpll_freq_khz; | 50 | unsigned int mpll_freq_khz = exynos_info->mpll_freq_khz; |
51 | struct device *dev = exynos_info->dev; | ||
52 | unsigned int old_freq; | 52 | unsigned int old_freq; |
53 | int index, old_index; | 53 | int index, old_index; |
54 | int ret = 0; | 54 | int ret = 0; |
@@ -90,8 +90,8 @@ static int exynos_cpufreq_scale(unsigned int target_freq) | |||
90 | /* Firstly, voltage up to increase frequency */ | 90 | /* Firstly, voltage up to increase frequency */ |
91 | ret = regulator_set_voltage(arm_regulator, arm_volt, arm_volt); | 91 | ret = regulator_set_voltage(arm_regulator, arm_volt, arm_volt); |
92 | if (ret) { | 92 | if (ret) { |
93 | pr_err("%s: failed to set cpu voltage to %d\n", | 93 | dev_err(dev, "failed to set cpu voltage to %d\n", |
94 | __func__, arm_volt); | 94 | arm_volt); |
95 | return ret; | 95 | return ret; |
96 | } | 96 | } |
97 | } | 97 | } |
@@ -100,8 +100,8 @@ static int exynos_cpufreq_scale(unsigned int target_freq) | |||
100 | ret = regulator_set_voltage(arm_regulator, safe_arm_volt, | 100 | ret = regulator_set_voltage(arm_regulator, safe_arm_volt, |
101 | safe_arm_volt); | 101 | safe_arm_volt); |
102 | if (ret) { | 102 | if (ret) { |
103 | pr_err("%s: failed to set cpu voltage to %d\n", | 103 | dev_err(dev, "failed to set cpu voltage to %d\n", |
104 | __func__, safe_arm_volt); | 104 | safe_arm_volt); |
105 | return ret; | 105 | return ret; |
106 | } | 106 | } |
107 | } | 107 | } |
@@ -115,8 +115,8 @@ static int exynos_cpufreq_scale(unsigned int target_freq) | |||
115 | ret = regulator_set_voltage(arm_regulator, arm_volt, | 115 | ret = regulator_set_voltage(arm_regulator, arm_volt, |
116 | arm_volt); | 116 | arm_volt); |
117 | if (ret) { | 117 | if (ret) { |
118 | pr_err("%s: failed to set cpu voltage to %d\n", | 118 | dev_err(dev, "failed to set cpu voltage to %d\n", |
119 | __func__, arm_volt); | 119 | arm_volt); |
120 | goto out; | 120 | goto out; |
121 | } | 121 | } |
122 | } | 122 | } |
@@ -163,6 +163,8 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) | |||
163 | if (!exynos_info) | 163 | if (!exynos_info) |
164 | return -ENOMEM; | 164 | return -ENOMEM; |
165 | 165 | ||
166 | exynos_info->dev = &pdev->dev; | ||
167 | |||
166 | if (soc_is_exynos4210()) | 168 | if (soc_is_exynos4210()) |
167 | ret = exynos4210_cpufreq_init(exynos_info); | 169 | ret = exynos4210_cpufreq_init(exynos_info); |
168 | else if (soc_is_exynos4212() || soc_is_exynos4412()) | 170 | else if (soc_is_exynos4212() || soc_is_exynos4412()) |
@@ -176,13 +178,13 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) | |||
176 | goto err_vdd_arm; | 178 | goto err_vdd_arm; |
177 | 179 | ||
178 | if (exynos_info->set_freq == NULL) { | 180 | if (exynos_info->set_freq == NULL) { |
179 | pr_err("%s: No set_freq function (ERR)\n", __func__); | 181 | dev_err(&pdev->dev, "No set_freq function (ERR)\n"); |
180 | goto err_vdd_arm; | 182 | goto err_vdd_arm; |
181 | } | 183 | } |
182 | 184 | ||
183 | arm_regulator = regulator_get(NULL, "vdd_arm"); | 185 | arm_regulator = regulator_get(NULL, "vdd_arm"); |
184 | if (IS_ERR(arm_regulator)) { | 186 | if (IS_ERR(arm_regulator)) { |
185 | pr_err("%s: failed to get resource vdd_arm\n", __func__); | 187 | dev_err(&pdev->dev, "failed to get resource vdd_arm\n"); |
186 | goto err_vdd_arm; | 188 | goto err_vdd_arm; |
187 | } | 189 | } |
188 | 190 | ||
@@ -192,7 +194,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) | |||
192 | if (!cpufreq_register_driver(&exynos_driver)) | 194 | if (!cpufreq_register_driver(&exynos_driver)) |
193 | return 0; | 195 | return 0; |
194 | 196 | ||
195 | pr_err("%s: failed to register cpufreq driver\n", __func__); | 197 | dev_err(&pdev->dev, "failed to register cpufreq driver\n"); |
196 | regulator_put(arm_regulator); | 198 | regulator_put(arm_regulator); |
197 | err_vdd_arm: | 199 | err_vdd_arm: |
198 | kfree(exynos_info); | 200 | kfree(exynos_info); |
diff --git a/drivers/cpufreq/exynos-cpufreq.h b/drivers/cpufreq/exynos-cpufreq.h index 3ddade8a5125..b72ff10a040e 100644 --- a/drivers/cpufreq/exynos-cpufreq.h +++ b/drivers/cpufreq/exynos-cpufreq.h | |||
@@ -34,6 +34,7 @@ struct apll_freq { | |||
34 | }; | 34 | }; |
35 | 35 | ||
36 | struct exynos_dvfs_info { | 36 | struct exynos_dvfs_info { |
37 | struct device *dev; | ||
37 | unsigned long mpll_freq_khz; | 38 | unsigned long mpll_freq_khz; |
38 | unsigned int pll_safe_idx; | 39 | unsigned int pll_safe_idx; |
39 | struct clk *cpu_clk; | 40 | struct clk *cpu_clk; |
diff --git a/drivers/cpufreq/exynos5440-cpufreq.c b/drivers/cpufreq/exynos5440-cpufreq.c index a6b8214d7b77..f33f25b483ca 100644 --- a/drivers/cpufreq/exynos5440-cpufreq.c +++ b/drivers/cpufreq/exynos5440-cpufreq.c | |||
@@ -114,25 +114,23 @@ static struct cpufreq_freqs freqs; | |||
114 | 114 | ||
115 | static int init_div_table(void) | 115 | static int init_div_table(void) |
116 | { | 116 | { |
117 | struct cpufreq_frequency_table *freq_tbl = dvfs_info->freq_table; | 117 | struct cpufreq_frequency_table *pos, *freq_tbl = dvfs_info->freq_table; |
118 | unsigned int tmp, clk_div, ema_div, freq, volt_id; | 118 | unsigned int tmp, clk_div, ema_div, freq, volt_id; |
119 | int i = 0; | ||
120 | struct dev_pm_opp *opp; | 119 | struct dev_pm_opp *opp; |
121 | 120 | ||
122 | rcu_read_lock(); | 121 | rcu_read_lock(); |
123 | for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) { | 122 | cpufreq_for_each_entry(pos, freq_tbl) { |
124 | |||
125 | opp = dev_pm_opp_find_freq_exact(dvfs_info->dev, | 123 | opp = dev_pm_opp_find_freq_exact(dvfs_info->dev, |
126 | freq_tbl[i].frequency * 1000, true); | 124 | pos->frequency * 1000, true); |
127 | if (IS_ERR(opp)) { | 125 | if (IS_ERR(opp)) { |
128 | rcu_read_unlock(); | 126 | rcu_read_unlock(); |
129 | dev_err(dvfs_info->dev, | 127 | dev_err(dvfs_info->dev, |
130 | "failed to find valid OPP for %u KHZ\n", | 128 | "failed to find valid OPP for %u KHZ\n", |
131 | freq_tbl[i].frequency); | 129 | pos->frequency); |
132 | return PTR_ERR(opp); | 130 | return PTR_ERR(opp); |
133 | } | 131 | } |
134 | 132 | ||
135 | freq = freq_tbl[i].frequency / 1000; /* In MHZ */ | 133 | freq = pos->frequency / 1000; /* In MHZ */ |
136 | clk_div = ((freq / CPU_DIV_FREQ_MAX) & P0_7_CPUCLKDEV_MASK) | 134 | clk_div = ((freq / CPU_DIV_FREQ_MAX) & P0_7_CPUCLKDEV_MASK) |
137 | << P0_7_CPUCLKDEV_SHIFT; | 135 | << P0_7_CPUCLKDEV_SHIFT; |
138 | clk_div |= ((freq / CPU_ATB_FREQ_MAX) & P0_7_ATBCLKDEV_MASK) | 136 | clk_div |= ((freq / CPU_ATB_FREQ_MAX) & P0_7_ATBCLKDEV_MASK) |
@@ -157,7 +155,8 @@ static int init_div_table(void) | |||
157 | tmp = (clk_div | ema_div | (volt_id << P0_7_VDD_SHIFT) | 155 | tmp = (clk_div | ema_div | (volt_id << P0_7_VDD_SHIFT) |
158 | | ((freq / FREQ_UNIT) << P0_7_FREQ_SHIFT)); | 156 | | ((freq / FREQ_UNIT) << P0_7_FREQ_SHIFT)); |
159 | 157 | ||
160 | __raw_writel(tmp, dvfs_info->base + XMU_PMU_P0_7 + 4 * i); | 158 | __raw_writel(tmp, dvfs_info->base + XMU_PMU_P0_7 + 4 * |
159 | (pos - freq_tbl)); | ||
161 | } | 160 | } |
162 | 161 | ||
163 | rcu_read_unlock(); | 162 | rcu_read_unlock(); |
@@ -166,8 +165,9 @@ static int init_div_table(void) | |||
166 | 165 | ||
167 | static void exynos_enable_dvfs(unsigned int cur_frequency) | 166 | static void exynos_enable_dvfs(unsigned int cur_frequency) |
168 | { | 167 | { |
169 | unsigned int tmp, i, cpu; | 168 | unsigned int tmp, cpu; |
170 | struct cpufreq_frequency_table *freq_table = dvfs_info->freq_table; | 169 | struct cpufreq_frequency_table *freq_table = dvfs_info->freq_table; |
170 | struct cpufreq_frequency_table *pos; | ||
171 | /* Disable DVFS */ | 171 | /* Disable DVFS */ |
172 | __raw_writel(0, dvfs_info->base + XMU_DVFS_CTRL); | 172 | __raw_writel(0, dvfs_info->base + XMU_DVFS_CTRL); |
173 | 173 | ||
@@ -182,15 +182,15 @@ static void exynos_enable_dvfs(unsigned int cur_frequency) | |||
182 | __raw_writel(tmp, dvfs_info->base + XMU_PMUIRQEN); | 182 | __raw_writel(tmp, dvfs_info->base + XMU_PMUIRQEN); |
183 | 183 | ||
184 | /* Set initial performance index */ | 184 | /* Set initial performance index */ |
185 | for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) | 185 | cpufreq_for_each_entry(pos, freq_table) |
186 | if (freq_table[i].frequency == cur_frequency) | 186 | if (pos->frequency == cur_frequency) |
187 | break; | 187 | break; |
188 | 188 | ||
189 | if (freq_table[i].frequency == CPUFREQ_TABLE_END) { | 189 | if (pos->frequency == CPUFREQ_TABLE_END) { |
190 | dev_crit(dvfs_info->dev, "Boot up frequency not supported\n"); | 190 | dev_crit(dvfs_info->dev, "Boot up frequency not supported\n"); |
191 | /* Assign the highest frequency */ | 191 | /* Assign the highest frequency */ |
192 | i = 0; | 192 | pos = freq_table; |
193 | cur_frequency = freq_table[i].frequency; | 193 | cur_frequency = pos->frequency; |
194 | } | 194 | } |
195 | 195 | ||
196 | dev_info(dvfs_info->dev, "Setting dvfs initial frequency = %uKHZ", | 196 | dev_info(dvfs_info->dev, "Setting dvfs initial frequency = %uKHZ", |
@@ -199,7 +199,7 @@ static void exynos_enable_dvfs(unsigned int cur_frequency) | |||
199 | for (cpu = 0; cpu < CONFIG_NR_CPUS; cpu++) { | 199 | for (cpu = 0; cpu < CONFIG_NR_CPUS; cpu++) { |
200 | tmp = __raw_readl(dvfs_info->base + XMU_C0_3_PSTATE + cpu * 4); | 200 | tmp = __raw_readl(dvfs_info->base + XMU_C0_3_PSTATE + cpu * 4); |
201 | tmp &= ~(P_VALUE_MASK << C0_3_PSTATE_NEW_SHIFT); | 201 | tmp &= ~(P_VALUE_MASK << C0_3_PSTATE_NEW_SHIFT); |
202 | tmp |= (i << C0_3_PSTATE_NEW_SHIFT); | 202 | tmp |= ((pos - freq_table) << C0_3_PSTATE_NEW_SHIFT); |
203 | __raw_writel(tmp, dvfs_info->base + XMU_C0_3_PSTATE + cpu * 4); | 203 | __raw_writel(tmp, dvfs_info->base + XMU_C0_3_PSTATE + cpu * 4); |
204 | } | 204 | } |
205 | 205 | ||
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index 08e7bbcf6d73..8e518c689393 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c | |||
@@ -21,22 +21,19 @@ | |||
21 | int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, | 21 | int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, |
22 | struct cpufreq_frequency_table *table) | 22 | struct cpufreq_frequency_table *table) |
23 | { | 23 | { |
24 | struct cpufreq_frequency_table *pos; | ||
24 | unsigned int min_freq = ~0; | 25 | unsigned int min_freq = ~0; |
25 | unsigned int max_freq = 0; | 26 | unsigned int max_freq = 0; |
26 | unsigned int i; | 27 | unsigned int freq; |
27 | 28 | ||
28 | for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { | 29 | cpufreq_for_each_valid_entry(pos, table) { |
29 | unsigned int freq = table[i].frequency; | 30 | freq = pos->frequency; |
30 | if (freq == CPUFREQ_ENTRY_INVALID) { | ||
31 | pr_debug("table entry %u is invalid, skipping\n", i); | ||
32 | 31 | ||
33 | continue; | ||
34 | } | ||
35 | if (!cpufreq_boost_enabled() | 32 | if (!cpufreq_boost_enabled() |
36 | && (table[i].flags & CPUFREQ_BOOST_FREQ)) | 33 | && (pos->flags & CPUFREQ_BOOST_FREQ)) |
37 | continue; | 34 | continue; |
38 | 35 | ||
39 | pr_debug("table entry %u: %u kHz\n", i, freq); | 36 | pr_debug("table entry %u: %u kHz\n", (int)(pos - table), freq); |
40 | if (freq < min_freq) | 37 | if (freq < min_freq) |
41 | min_freq = freq; | 38 | min_freq = freq; |
42 | if (freq > max_freq) | 39 | if (freq > max_freq) |
@@ -57,7 +54,8 @@ EXPORT_SYMBOL_GPL(cpufreq_frequency_table_cpuinfo); | |||
57 | int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, | 54 | int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, |
58 | struct cpufreq_frequency_table *table) | 55 | struct cpufreq_frequency_table *table) |
59 | { | 56 | { |
60 | unsigned int next_larger = ~0, freq, i = 0; | 57 | struct cpufreq_frequency_table *pos; |
58 | unsigned int freq, next_larger = ~0; | ||
61 | bool found = false; | 59 | bool found = false; |
62 | 60 | ||
63 | pr_debug("request for verification of policy (%u - %u kHz) for cpu %u\n", | 61 | pr_debug("request for verification of policy (%u - %u kHz) for cpu %u\n", |
@@ -65,9 +63,9 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, | |||
65 | 63 | ||
66 | cpufreq_verify_within_cpu_limits(policy); | 64 | cpufreq_verify_within_cpu_limits(policy); |
67 | 65 | ||
68 | for (; freq = table[i].frequency, freq != CPUFREQ_TABLE_END; i++) { | 66 | cpufreq_for_each_valid_entry(pos, table) { |
69 | if (freq == CPUFREQ_ENTRY_INVALID) | 67 | freq = pos->frequency; |
70 | continue; | 68 | |
71 | if ((freq >= policy->min) && (freq <= policy->max)) { | 69 | if ((freq >= policy->min) && (freq <= policy->max)) { |
72 | found = true; | 70 | found = true; |
73 | break; | 71 | break; |
@@ -118,7 +116,8 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, | |||
118 | .driver_data = ~0, | 116 | .driver_data = ~0, |
119 | .frequency = 0, | 117 | .frequency = 0, |
120 | }; | 118 | }; |
121 | unsigned int i; | 119 | struct cpufreq_frequency_table *pos; |
120 | unsigned int freq, i = 0; | ||
122 | 121 | ||
123 | pr_debug("request for target %u kHz (relation: %u) for cpu %u\n", | 122 | pr_debug("request for target %u kHz (relation: %u) for cpu %u\n", |
124 | target_freq, relation, policy->cpu); | 123 | target_freq, relation, policy->cpu); |
@@ -132,10 +131,10 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, | |||
132 | break; | 131 | break; |
133 | } | 132 | } |
134 | 133 | ||
135 | for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { | 134 | cpufreq_for_each_valid_entry(pos, table) { |
136 | unsigned int freq = table[i].frequency; | 135 | freq = pos->frequency; |
137 | if (freq == CPUFREQ_ENTRY_INVALID) | 136 | |
138 | continue; | 137 | i = pos - table; |
139 | if ((freq < policy->min) || (freq > policy->max)) | 138 | if ((freq < policy->min) || (freq > policy->max)) |
140 | continue; | 139 | continue; |
141 | switch (relation) { | 140 | switch (relation) { |
@@ -184,8 +183,7 @@ EXPORT_SYMBOL_GPL(cpufreq_frequency_table_target); | |||
184 | int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy, | 183 | int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy, |
185 | unsigned int freq) | 184 | unsigned int freq) |
186 | { | 185 | { |
187 | struct cpufreq_frequency_table *table; | 186 | struct cpufreq_frequency_table *pos, *table; |
188 | int i; | ||
189 | 187 | ||
190 | table = cpufreq_frequency_get_table(policy->cpu); | 188 | table = cpufreq_frequency_get_table(policy->cpu); |
191 | if (unlikely(!table)) { | 189 | if (unlikely(!table)) { |
@@ -193,10 +191,9 @@ int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy, | |||
193 | return -ENOENT; | 191 | return -ENOENT; |
194 | } | 192 | } |
195 | 193 | ||
196 | for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) { | 194 | cpufreq_for_each_valid_entry(pos, table) |
197 | if (table[i].frequency == freq) | 195 | if (pos->frequency == freq) |
198 | return i; | 196 | return pos - table; |
199 | } | ||
200 | 197 | ||
201 | return -EINVAL; | 198 | return -EINVAL; |
202 | } | 199 | } |
@@ -208,16 +205,13 @@ EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_index); | |||
208 | static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf, | 205 | static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf, |
209 | bool show_boost) | 206 | bool show_boost) |
210 | { | 207 | { |
211 | unsigned int i = 0; | ||
212 | ssize_t count = 0; | 208 | ssize_t count = 0; |
213 | struct cpufreq_frequency_table *table = policy->freq_table; | 209 | struct cpufreq_frequency_table *pos, *table = policy->freq_table; |
214 | 210 | ||
215 | if (!table) | 211 | if (!table) |
216 | return -ENODEV; | 212 | return -ENODEV; |
217 | 213 | ||
218 | for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { | 214 | cpufreq_for_each_valid_entry(pos, table) { |
219 | if (table[i].frequency == CPUFREQ_ENTRY_INVALID) | ||
220 | continue; | ||
221 | /* | 215 | /* |
222 | * show_boost = true and driver_data = BOOST freq | 216 | * show_boost = true and driver_data = BOOST freq |
223 | * display BOOST freqs | 217 | * display BOOST freqs |
@@ -229,10 +223,10 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf, | |||
229 | * show_boost = false and driver_data != BOOST freq | 223 | * show_boost = false and driver_data != BOOST freq |
230 | * display NON BOOST freqs | 224 | * display NON BOOST freqs |
231 | */ | 225 | */ |
232 | if (show_boost ^ (table[i].flags & CPUFREQ_BOOST_FREQ)) | 226 | if (show_boost ^ (pos->flags & CPUFREQ_BOOST_FREQ)) |
233 | continue; | 227 | continue; |
234 | 228 | ||
235 | count += sprintf(&buf[count], "%d ", table[i].frequency); | 229 | count += sprintf(&buf[count], "%d ", pos->frequency); |
236 | } | 230 | } |
237 | count += sprintf(&buf[count], "\n"); | 231 | count += sprintf(&buf[count], "\n"); |
238 | 232 | ||
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 099967302bf2..6658bef99352 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -32,8 +32,6 @@ | |||
32 | #include <asm/msr.h> | 32 | #include <asm/msr.h> |
33 | #include <asm/cpu_device_id.h> | 33 | #include <asm/cpu_device_id.h> |
34 | 34 | ||
35 | #define SAMPLE_COUNT 3 | ||
36 | |||
37 | #define BYT_RATIOS 0x66a | 35 | #define BYT_RATIOS 0x66a |
38 | #define BYT_VIDS 0x66b | 36 | #define BYT_VIDS 0x66b |
39 | #define BYT_TURBO_RATIOS 0x66c | 37 | #define BYT_TURBO_RATIOS 0x66c |
@@ -553,14 +551,13 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) | |||
553 | intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate); | 551 | intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate); |
554 | } | 552 | } |
555 | 553 | ||
556 | static inline void intel_pstate_calc_busy(struct cpudata *cpu, | 554 | static inline void intel_pstate_calc_busy(struct cpudata *cpu) |
557 | struct sample *sample) | ||
558 | { | 555 | { |
556 | struct sample *sample = &cpu->sample; | ||
559 | int32_t core_pct; | 557 | int32_t core_pct; |
560 | int32_t c0_pct; | 558 | int32_t c0_pct; |
561 | 559 | ||
562 | core_pct = div_fp(int_tofp((sample->aperf)), | 560 | core_pct = div_fp(int_tofp(sample->aperf), int_tofp(sample->mperf)); |
563 | int_tofp((sample->mperf))); | ||
564 | core_pct = mul_fp(core_pct, int_tofp(100)); | 561 | core_pct = mul_fp(core_pct, int_tofp(100)); |
565 | FP_ROUNDUP(core_pct); | 562 | FP_ROUNDUP(core_pct); |
566 | 563 | ||
@@ -592,7 +589,7 @@ static inline void intel_pstate_sample(struct cpudata *cpu) | |||
592 | cpu->sample.mperf -= cpu->prev_mperf; | 589 | cpu->sample.mperf -= cpu->prev_mperf; |
593 | cpu->sample.tsc -= cpu->prev_tsc; | 590 | cpu->sample.tsc -= cpu->prev_tsc; |
594 | 591 | ||
595 | intel_pstate_calc_busy(cpu, &cpu->sample); | 592 | intel_pstate_calc_busy(cpu); |
596 | 593 | ||
597 | cpu->prev_aperf = aperf; | 594 | cpu->prev_aperf = aperf; |
598 | cpu->prev_mperf = mperf; | 595 | cpu->prev_mperf = mperf; |
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index 5c4369b5d834..c913906a719e 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c | |||
@@ -530,6 +530,7 @@ static int longhaul_get_ranges(void) | |||
530 | 530 | ||
531 | static void longhaul_setup_voltagescaling(void) | 531 | static void longhaul_setup_voltagescaling(void) |
532 | { | 532 | { |
533 | struct cpufreq_frequency_table *freq_pos; | ||
533 | union msr_longhaul longhaul; | 534 | union msr_longhaul longhaul; |
534 | struct mV_pos minvid, maxvid, vid; | 535 | struct mV_pos minvid, maxvid, vid; |
535 | unsigned int j, speed, pos, kHz_step, numvscales; | 536 | unsigned int j, speed, pos, kHz_step, numvscales; |
@@ -608,18 +609,16 @@ static void longhaul_setup_voltagescaling(void) | |||
608 | /* Calculate kHz for one voltage step */ | 609 | /* Calculate kHz for one voltage step */ |
609 | kHz_step = (highest_speed - min_vid_speed) / numvscales; | 610 | kHz_step = (highest_speed - min_vid_speed) / numvscales; |
610 | 611 | ||
611 | j = 0; | 612 | cpufreq_for_each_entry(freq_pos, longhaul_table) { |
612 | while (longhaul_table[j].frequency != CPUFREQ_TABLE_END) { | 613 | speed = freq_pos->frequency; |
613 | speed = longhaul_table[j].frequency; | ||
614 | if (speed > min_vid_speed) | 614 | if (speed > min_vid_speed) |
615 | pos = (speed - min_vid_speed) / kHz_step + minvid.pos; | 615 | pos = (speed - min_vid_speed) / kHz_step + minvid.pos; |
616 | else | 616 | else |
617 | pos = minvid.pos; | 617 | pos = minvid.pos; |
618 | longhaul_table[j].driver_data |= mV_vrm_table[pos] << 8; | 618 | freq_pos->driver_data |= mV_vrm_table[pos] << 8; |
619 | vid = vrm_mV_table[mV_vrm_table[pos]]; | 619 | vid = vrm_mV_table[mV_vrm_table[pos]]; |
620 | printk(KERN_INFO PFX "f: %d kHz, index: %d, vid: %d mV\n", | 620 | printk(KERN_INFO PFX "f: %d kHz, index: %d, vid: %d mV\n", |
621 | speed, j, vid.mV); | 621 | speed, (int)(freq_pos - longhaul_table), vid.mV); |
622 | j++; | ||
623 | } | 622 | } |
624 | 623 | ||
625 | can_scale_voltage = 1; | 624 | can_scale_voltage = 1; |
diff --git a/drivers/cpufreq/pasemi-cpufreq.c b/drivers/cpufreq/pasemi-cpufreq.c index 84c84b5f0f3a..35dd4d7ffee0 100644 --- a/drivers/cpufreq/pasemi-cpufreq.c +++ b/drivers/cpufreq/pasemi-cpufreq.c | |||
@@ -136,9 +136,10 @@ void restore_astate(int cpu) | |||
136 | 136 | ||
137 | static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) | 137 | static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) |
138 | { | 138 | { |
139 | struct cpufreq_frequency_table *pos; | ||
139 | const u32 *max_freqp; | 140 | const u32 *max_freqp; |
140 | u32 max_freq; | 141 | u32 max_freq; |
141 | int i, cur_astate; | 142 | int cur_astate; |
142 | struct resource res; | 143 | struct resource res; |
143 | struct device_node *cpu, *dn; | 144 | struct device_node *cpu, *dn; |
144 | int err = -ENODEV; | 145 | int err = -ENODEV; |
@@ -197,10 +198,9 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
197 | pr_debug("initializing frequency table\n"); | 198 | pr_debug("initializing frequency table\n"); |
198 | 199 | ||
199 | /* initialize frequency table */ | 200 | /* initialize frequency table */ |
200 | for (i=0; pas_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) { | 201 | cpufreq_for_each_entry(pos, pas_freqs) { |
201 | pas_freqs[i].frequency = | 202 | pos->frequency = get_astate_freq(pos->driver_data) * 100000; |
202 | get_astate_freq(pas_freqs[i].driver_data) * 100000; | 203 | pr_debug("%d: %d\n", (int)(pos - pas_freqs), pos->frequency); |
203 | pr_debug("%d: %d\n", i, pas_freqs[i].frequency); | ||
204 | } | 204 | } |
205 | 205 | ||
206 | cur_astate = get_cur_astate(policy->cpu); | 206 | cur_astate = get_cur_astate(policy->cpu); |
diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c index 78904e6ca4a0..c8012bc86910 100644 --- a/drivers/cpufreq/powernow-k6.c +++ b/drivers/cpufreq/powernow-k6.c | |||
@@ -151,6 +151,7 @@ static int powernow_k6_target(struct cpufreq_policy *policy, | |||
151 | 151 | ||
152 | static int powernow_k6_cpu_init(struct cpufreq_policy *policy) | 152 | static int powernow_k6_cpu_init(struct cpufreq_policy *policy) |
153 | { | 153 | { |
154 | struct cpufreq_frequency_table *pos; | ||
154 | unsigned int i, f; | 155 | unsigned int i, f; |
155 | unsigned khz; | 156 | unsigned khz; |
156 | 157 | ||
@@ -168,12 +169,11 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy) | |||
168 | } | 169 | } |
169 | } | 170 | } |
170 | if (param_max_multiplier) { | 171 | if (param_max_multiplier) { |
171 | for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) { | 172 | cpufreq_for_each_entry(pos, clock_ratio) |
172 | if (clock_ratio[i].driver_data == param_max_multiplier) { | 173 | if (pos->driver_data == param_max_multiplier) { |
173 | max_multiplier = param_max_multiplier; | 174 | max_multiplier = param_max_multiplier; |
174 | goto have_max_multiplier; | 175 | goto have_max_multiplier; |
175 | } | 176 | } |
176 | } | ||
177 | printk(KERN_ERR "powernow-k6: invalid max_multiplier parameter, valid parameters 20, 30, 35, 40, 45, 50, 55, 60\n"); | 177 | printk(KERN_ERR "powernow-k6: invalid max_multiplier parameter, valid parameters 20, 30, 35, 40, 45, 50, 55, 60\n"); |
178 | return -EINVAL; | 178 | return -EINVAL; |
179 | } | 179 | } |
@@ -201,12 +201,12 @@ have_busfreq: | |||
201 | param_busfreq = busfreq * 10; | 201 | param_busfreq = busfreq * 10; |
202 | 202 | ||
203 | /* table init */ | 203 | /* table init */ |
204 | for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) { | 204 | cpufreq_for_each_entry(pos, clock_ratio) { |
205 | f = clock_ratio[i].driver_data; | 205 | f = pos->driver_data; |
206 | if (f > max_multiplier) | 206 | if (f > max_multiplier) |
207 | clock_ratio[i].frequency = CPUFREQ_ENTRY_INVALID; | 207 | pos->frequency = CPUFREQ_ENTRY_INVALID; |
208 | else | 208 | else |
209 | clock_ratio[i].frequency = busfreq * f; | 209 | pos->frequency = busfreq * f; |
210 | } | 210 | } |
211 | 211 | ||
212 | /* cpuinfo and default policy values */ | 212 | /* cpuinfo and default policy values */ |
diff --git a/drivers/cpufreq/ppc_cbe_cpufreq.c b/drivers/cpufreq/ppc_cbe_cpufreq.c index 5be8a48dba74..5a4c5a639f61 100644 --- a/drivers/cpufreq/ppc_cbe_cpufreq.c +++ b/drivers/cpufreq/ppc_cbe_cpufreq.c | |||
@@ -67,9 +67,10 @@ static int set_pmode(unsigned int cpu, unsigned int slow_mode) | |||
67 | 67 | ||
68 | static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) | 68 | static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) |
69 | { | 69 | { |
70 | struct cpufreq_frequency_table *pos; | ||
70 | const u32 *max_freqp; | 71 | const u32 *max_freqp; |
71 | u32 max_freq; | 72 | u32 max_freq; |
72 | int i, cur_pmode; | 73 | int cur_pmode; |
73 | struct device_node *cpu; | 74 | struct device_node *cpu; |
74 | 75 | ||
75 | cpu = of_get_cpu_node(policy->cpu, NULL); | 76 | cpu = of_get_cpu_node(policy->cpu, NULL); |
@@ -102,9 +103,9 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
102 | pr_debug("initializing frequency table\n"); | 103 | pr_debug("initializing frequency table\n"); |
103 | 104 | ||
104 | /* initialize frequency table */ | 105 | /* initialize frequency table */ |
105 | for (i=0; cbe_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) { | 106 | cpufreq_for_each_entry(pos, cbe_freqs) { |
106 | cbe_freqs[i].frequency = max_freq / cbe_freqs[i].driver_data; | 107 | pos->frequency = max_freq / pos->driver_data; |
107 | pr_debug("%d: %d\n", i, cbe_freqs[i].frequency); | 108 | pr_debug("%d: %d\n", (int)(pos - cbe_freqs), pos->frequency); |
108 | } | 109 | } |
109 | 110 | ||
110 | /* if DEBUG is enabled set_pmode() measures the latency | 111 | /* if DEBUG is enabled set_pmode() measures the latency |
diff --git a/drivers/cpufreq/s3c2416-cpufreq.c b/drivers/cpufreq/s3c2416-cpufreq.c index 4626f90559b5..2fd53eaaec20 100644 --- a/drivers/cpufreq/s3c2416-cpufreq.c +++ b/drivers/cpufreq/s3c2416-cpufreq.c | |||
@@ -266,7 +266,7 @@ out: | |||
266 | static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq) | 266 | static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq) |
267 | { | 267 | { |
268 | int count, v, i, found; | 268 | int count, v, i, found; |
269 | struct cpufreq_frequency_table *freq; | 269 | struct cpufreq_frequency_table *pos; |
270 | struct s3c2416_dvfs *dvfs; | 270 | struct s3c2416_dvfs *dvfs; |
271 | 271 | ||
272 | count = regulator_count_voltages(s3c_freq->vddarm); | 272 | count = regulator_count_voltages(s3c_freq->vddarm); |
@@ -275,12 +275,11 @@ static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq) | |||
275 | return; | 275 | return; |
276 | } | 276 | } |
277 | 277 | ||
278 | freq = s3c_freq->freq_table; | 278 | if (!count) |
279 | while (count > 0 && freq->frequency != CPUFREQ_TABLE_END) { | 279 | goto out; |
280 | if (freq->frequency == CPUFREQ_ENTRY_INVALID) | ||
281 | continue; | ||
282 | 280 | ||
283 | dvfs = &s3c2416_dvfs_table[freq->driver_data]; | 281 | cpufreq_for_each_valid_entry(pos, s3c_freq->freq_table) { |
282 | dvfs = &s3c2416_dvfs_table[pos->driver_data]; | ||
284 | found = 0; | 283 | found = 0; |
285 | 284 | ||
286 | /* Check only the min-voltage, more is always ok on S3C2416 */ | 285 | /* Check only the min-voltage, more is always ok on S3C2416 */ |
@@ -292,13 +291,12 @@ static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq) | |||
292 | 291 | ||
293 | if (!found) { | 292 | if (!found) { |
294 | pr_debug("cpufreq: %dkHz unsupported by regulator\n", | 293 | pr_debug("cpufreq: %dkHz unsupported by regulator\n", |
295 | freq->frequency); | 294 | pos->frequency); |
296 | freq->frequency = CPUFREQ_ENTRY_INVALID; | 295 | pos->frequency = CPUFREQ_ENTRY_INVALID; |
297 | } | 296 | } |
298 | |||
299 | freq++; | ||
300 | } | 297 | } |
301 | 298 | ||
299 | out: | ||
302 | /* Guessed */ | 300 | /* Guessed */ |
303 | s3c_freq->regulator_latency = 1 * 1000 * 1000; | 301 | s3c_freq->regulator_latency = 1 * 1000 * 1000; |
304 | } | 302 | } |
@@ -338,7 +336,7 @@ static struct notifier_block s3c2416_cpufreq_reboot_notifier = { | |||
338 | static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy) | 336 | static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy) |
339 | { | 337 | { |
340 | struct s3c2416_data *s3c_freq = &s3c2416_cpufreq; | 338 | struct s3c2416_data *s3c_freq = &s3c2416_cpufreq; |
341 | struct cpufreq_frequency_table *freq; | 339 | struct cpufreq_frequency_table *pos; |
342 | struct clk *msysclk; | 340 | struct clk *msysclk; |
343 | unsigned long rate; | 341 | unsigned long rate; |
344 | int ret; | 342 | int ret; |
@@ -427,31 +425,27 @@ static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy) | |||
427 | s3c_freq->regulator_latency = 0; | 425 | s3c_freq->regulator_latency = 0; |
428 | #endif | 426 | #endif |
429 | 427 | ||
430 | freq = s3c_freq->freq_table; | 428 | cpufreq_for_each_entry(pos, s3c_freq->freq_table) { |
431 | while (freq->frequency != CPUFREQ_TABLE_END) { | ||
432 | /* special handling for dvs mode */ | 429 | /* special handling for dvs mode */ |
433 | if (freq->driver_data == 0) { | 430 | if (pos->driver_data == 0) { |
434 | if (!s3c_freq->hclk) { | 431 | if (!s3c_freq->hclk) { |
435 | pr_debug("cpufreq: %dkHz unsupported as it would need unavailable dvs mode\n", | 432 | pr_debug("cpufreq: %dkHz unsupported as it would need unavailable dvs mode\n", |
436 | freq->frequency); | 433 | pos->frequency); |
437 | freq->frequency = CPUFREQ_ENTRY_INVALID; | 434 | pos->frequency = CPUFREQ_ENTRY_INVALID; |
438 | } else { | 435 | } else { |
439 | freq++; | ||
440 | continue; | 436 | continue; |
441 | } | 437 | } |
442 | } | 438 | } |
443 | 439 | ||
444 | /* Check for frequencies we can generate */ | 440 | /* Check for frequencies we can generate */ |
445 | rate = clk_round_rate(s3c_freq->armdiv, | 441 | rate = clk_round_rate(s3c_freq->armdiv, |
446 | freq->frequency * 1000); | 442 | pos->frequency * 1000); |
447 | rate /= 1000; | 443 | rate /= 1000; |
448 | if (rate != freq->frequency) { | 444 | if (rate != pos->frequency) { |
449 | pr_debug("cpufreq: %dkHz unsupported by clock (clk_round_rate return %lu)\n", | 445 | pr_debug("cpufreq: %dkHz unsupported by clock (clk_round_rate return %lu)\n", |
450 | freq->frequency, rate); | 446 | pos->frequency, rate); |
451 | freq->frequency = CPUFREQ_ENTRY_INVALID; | 447 | pos->frequency = CPUFREQ_ENTRY_INVALID; |
452 | } | 448 | } |
453 | |||
454 | freq++; | ||
455 | } | 449 | } |
456 | 450 | ||
457 | /* Datasheet says PLL stabalisation time must be at least 300us, | 451 | /* Datasheet says PLL stabalisation time must be at least 300us, |
diff --git a/drivers/cpufreq/s3c64xx-cpufreq.c b/drivers/cpufreq/s3c64xx-cpufreq.c index ff7d3ecb85f0..176e84cc3991 100644 --- a/drivers/cpufreq/s3c64xx-cpufreq.c +++ b/drivers/cpufreq/s3c64xx-cpufreq.c | |||
@@ -118,11 +118,10 @@ static void __init s3c64xx_cpufreq_config_regulator(void) | |||
118 | pr_err("Unable to check supported voltages\n"); | 118 | pr_err("Unable to check supported voltages\n"); |
119 | } | 119 | } |
120 | 120 | ||
121 | freq = s3c64xx_freq_table; | 121 | if (!count) |
122 | while (count > 0 && freq->frequency != CPUFREQ_TABLE_END) { | 122 | goto out; |
123 | if (freq->frequency == CPUFREQ_ENTRY_INVALID) | ||
124 | continue; | ||
125 | 123 | ||
124 | cpufreq_for_each_valid_entry(freq, s3c64xx_freq_table) { | ||
126 | dvfs = &s3c64xx_dvfs_table[freq->driver_data]; | 125 | dvfs = &s3c64xx_dvfs_table[freq->driver_data]; |
127 | found = 0; | 126 | found = 0; |
128 | 127 | ||
@@ -137,10 +136,9 @@ static void __init s3c64xx_cpufreq_config_regulator(void) | |||
137 | freq->frequency); | 136 | freq->frequency); |
138 | freq->frequency = CPUFREQ_ENTRY_INVALID; | 137 | freq->frequency = CPUFREQ_ENTRY_INVALID; |
139 | } | 138 | } |
140 | |||
141 | freq++; | ||
142 | } | 139 | } |
143 | 140 | ||
141 | out: | ||
144 | /* Guess based on having to do an I2C/SPI write; in future we | 142 | /* Guess based on having to do an I2C/SPI write; in future we |
145 | * will be able to query the regulator performance here. */ | 143 | * will be able to query the regulator performance here. */ |
146 | regulator_latency = 1 * 1000 * 1000; | 144 | regulator_latency = 1 * 1000 * 1000; |
@@ -179,8 +177,7 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy) | |||
179 | } | 177 | } |
180 | #endif | 178 | #endif |
181 | 179 | ||
182 | freq = s3c64xx_freq_table; | 180 | cpufreq_for_each_entry(freq, s3c64xx_freq_table) { |
183 | while (freq->frequency != CPUFREQ_TABLE_END) { | ||
184 | unsigned long r; | 181 | unsigned long r; |
185 | 182 | ||
186 | /* Check for frequencies we can generate */ | 183 | /* Check for frequencies we can generate */ |
@@ -196,8 +193,6 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy) | |||
196 | * frequency is the maximum we can support. */ | 193 | * frequency is the maximum we can support. */ |
197 | if (!vddarm && freq->frequency > clk_get_rate(policy->clk) / 1000) | 194 | if (!vddarm && freq->frequency > clk_get_rate(policy->clk) / 1000) |
198 | freq->frequency = CPUFREQ_ENTRY_INVALID; | 195 | freq->frequency = CPUFREQ_ENTRY_INVALID; |
199 | |||
200 | freq++; | ||
201 | } | 196 | } |
202 | 197 | ||
203 | /* Datasheet says PLL stabalisation time (if we were to use | 198 | /* Datasheet says PLL stabalisation time (if we were to use |
diff --git a/drivers/cpufreq/speedstep-centrino.c b/drivers/cpufreq/speedstep-centrino.c index 6723f0390f20..7d4a31571608 100644 --- a/drivers/cpufreq/speedstep-centrino.c +++ b/drivers/cpufreq/speedstep-centrino.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <asm/cpu_device_id.h> | 28 | #include <asm/cpu_device_id.h> |
29 | 29 | ||
30 | #define PFX "speedstep-centrino: " | 30 | #define PFX "speedstep-centrino: " |
31 | #define MAINTAINER "cpufreq@vger.kernel.org" | 31 | #define MAINTAINER "linux-pm@vger.kernel.org" |
32 | 32 | ||
33 | #define INTEL_MSR_RANGE (0xffff) | 33 | #define INTEL_MSR_RANGE (0xffff) |
34 | 34 | ||