diff options
51 files changed, 238 insertions, 340 deletions
diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c index 4729eaab0f40..55eb8703043d 100644 --- a/arch/arm/mach-davinci/cpufreq.c +++ b/arch/arm/mach-davinci/cpufreq.c | |||
@@ -90,7 +90,6 @@ static int davinci_target(struct cpufreq_policy *policy, | |||
90 | 90 | ||
91 | freqs.old = davinci_getspeed(0); | 91 | freqs.old = davinci_getspeed(0); |
92 | freqs.new = clk_round_rate(armclk, target_freq * 1000) / 1000; | 92 | freqs.new = clk_round_rate(armclk, target_freq * 1000) / 1000; |
93 | freqs.cpu = 0; | ||
94 | 93 | ||
95 | if (freqs.old == freqs.new) | 94 | if (freqs.old == freqs.new) |
96 | return ret; | 95 | return ret; |
@@ -102,7 +101,7 @@ static int davinci_target(struct cpufreq_policy *policy, | |||
102 | if (ret) | 101 | if (ret) |
103 | return -EINVAL; | 102 | return -EINVAL; |
104 | 103 | ||
105 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 104 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
106 | 105 | ||
107 | /* if moving to higher frequency, up the voltage beforehand */ | 106 | /* if moving to higher frequency, up the voltage beforehand */ |
108 | if (pdata->set_voltage && freqs.new > freqs.old) { | 107 | if (pdata->set_voltage && freqs.new > freqs.old) { |
@@ -126,7 +125,7 @@ static int davinci_target(struct cpufreq_policy *policy, | |||
126 | pdata->set_voltage(idx); | 125 | pdata->set_voltage(idx); |
127 | 126 | ||
128 | out: | 127 | out: |
129 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 128 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
130 | 129 | ||
131 | return ret; | 130 | return ret; |
132 | } | 131 | } |
diff --git a/arch/arm/mach-imx/cpufreq.c b/arch/arm/mach-imx/cpufreq.c index d8c75c3c925d..cfce5e3f67f5 100644 --- a/arch/arm/mach-imx/cpufreq.c +++ b/arch/arm/mach-imx/cpufreq.c | |||
@@ -87,13 +87,12 @@ static int mxc_set_target(struct cpufreq_policy *policy, | |||
87 | 87 | ||
88 | freqs.old = clk_get_rate(cpu_clk) / 1000; | 88 | freqs.old = clk_get_rate(cpu_clk) / 1000; |
89 | freqs.new = freq_Hz / 1000; | 89 | freqs.new = freq_Hz / 1000; |
90 | freqs.cpu = 0; | ||
91 | freqs.flags = 0; | 90 | freqs.flags = 0; |
92 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 91 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
93 | 92 | ||
94 | ret = set_cpu_freq(freq_Hz); | 93 | ret = set_cpu_freq(freq_Hz); |
95 | 94 | ||
96 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 95 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
97 | 96 | ||
98 | return ret; | 97 | return ret; |
99 | } | 98 | } |
diff --git a/arch/arm/mach-integrator/cpu.c b/arch/arm/mach-integrator/cpu.c index 590c192cdf4d..df863c30771c 100644 --- a/arch/arm/mach-integrator/cpu.c +++ b/arch/arm/mach-integrator/cpu.c | |||
@@ -123,14 +123,12 @@ static int integrator_set_target(struct cpufreq_policy *policy, | |||
123 | vco = icst_hz_to_vco(&cclk_params, target_freq * 1000); | 123 | vco = icst_hz_to_vco(&cclk_params, target_freq * 1000); |
124 | freqs.new = icst_hz(&cclk_params, vco) / 1000; | 124 | freqs.new = icst_hz(&cclk_params, vco) / 1000; |
125 | 125 | ||
126 | freqs.cpu = policy->cpu; | ||
127 | |||
128 | if (freqs.old == freqs.new) { | 126 | if (freqs.old == freqs.new) { |
129 | set_cpus_allowed(current, cpus_allowed); | 127 | set_cpus_allowed(current, cpus_allowed); |
130 | return 0; | 128 | return 0; |
131 | } | 129 | } |
132 | 130 | ||
133 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 131 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
134 | 132 | ||
135 | cm_osc = __raw_readl(CM_OSC); | 133 | cm_osc = __raw_readl(CM_OSC); |
136 | 134 | ||
@@ -151,7 +149,7 @@ static int integrator_set_target(struct cpufreq_policy *policy, | |||
151 | */ | 149 | */ |
152 | set_cpus_allowed(current, cpus_allowed); | 150 | set_cpus_allowed(current, cpus_allowed); |
153 | 151 | ||
154 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 152 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
155 | 153 | ||
156 | return 0; | 154 | return 0; |
157 | } | 155 | } |
diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c b/arch/arm/mach-pxa/cpufreq-pxa2xx.c index 6a7aeab42f6c..f1ca4daa1ad6 100644 --- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c +++ b/arch/arm/mach-pxa/cpufreq-pxa2xx.c | |||
@@ -311,7 +311,6 @@ static int pxa_set_target(struct cpufreq_policy *policy, | |||
311 | new_freq_mem = pxa_freq_settings[idx].membus; | 311 | new_freq_mem = pxa_freq_settings[idx].membus; |
312 | freqs.old = policy->cur; | 312 | freqs.old = policy->cur; |
313 | freqs.new = new_freq_cpu; | 313 | freqs.new = new_freq_cpu; |
314 | freqs.cpu = policy->cpu; | ||
315 | 314 | ||
316 | if (freq_debug) | 315 | if (freq_debug) |
317 | pr_debug("Changing CPU frequency to %d Mhz, (SDRAM %d Mhz)\n", | 316 | pr_debug("Changing CPU frequency to %d Mhz, (SDRAM %d Mhz)\n", |
@@ -327,7 +326,7 @@ static int pxa_set_target(struct cpufreq_policy *policy, | |||
327 | * you should add a notify client with any platform specific | 326 | * you should add a notify client with any platform specific |
328 | * Vcc changing capability | 327 | * Vcc changing capability |
329 | */ | 328 | */ |
330 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 329 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
331 | 330 | ||
332 | /* Calculate the next MDREFR. If we're slowing down the SDRAM clock | 331 | /* Calculate the next MDREFR. If we're slowing down the SDRAM clock |
333 | * we need to preset the smaller DRI before the change. If we're | 332 | * we need to preset the smaller DRI before the change. If we're |
@@ -382,7 +381,7 @@ static int pxa_set_target(struct cpufreq_policy *policy, | |||
382 | * you should add a notify client with any platform specific | 381 | * you should add a notify client with any platform specific |
383 | * SDRAM refresh timer adjustments | 382 | * SDRAM refresh timer adjustments |
384 | */ | 383 | */ |
385 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 384 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
386 | 385 | ||
387 | /* | 386 | /* |
388 | * Even if voltage setting fails, we don't report it, as the frequency | 387 | * Even if voltage setting fails, we don't report it, as the frequency |
diff --git a/arch/arm/mach-pxa/cpufreq-pxa3xx.c b/arch/arm/mach-pxa/cpufreq-pxa3xx.c index b85b4ab7aac6..8c45b2b926a7 100644 --- a/arch/arm/mach-pxa/cpufreq-pxa3xx.c +++ b/arch/arm/mach-pxa/cpufreq-pxa3xx.c | |||
@@ -184,7 +184,6 @@ static int pxa3xx_cpufreq_set(struct cpufreq_policy *policy, | |||
184 | 184 | ||
185 | freqs.old = policy->cur; | 185 | freqs.old = policy->cur; |
186 | freqs.new = next->cpufreq_mhz * 1000; | 186 | freqs.new = next->cpufreq_mhz * 1000; |
187 | freqs.cpu = policy->cpu; | ||
188 | 187 | ||
189 | pr_debug("CPU frequency from %d MHz to %d MHz%s\n", | 188 | pr_debug("CPU frequency from %d MHz to %d MHz%s\n", |
190 | freqs.old / 1000, freqs.new / 1000, | 189 | freqs.old / 1000, freqs.new / 1000, |
@@ -193,14 +192,14 @@ static int pxa3xx_cpufreq_set(struct cpufreq_policy *policy, | |||
193 | if (freqs.old == target_freq) | 192 | if (freqs.old == target_freq) |
194 | return 0; | 193 | return 0; |
195 | 194 | ||
196 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 195 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
197 | 196 | ||
198 | local_irq_save(flags); | 197 | local_irq_save(flags); |
199 | __update_core_freq(next); | 198 | __update_core_freq(next); |
200 | __update_bus_freq(next); | 199 | __update_bus_freq(next); |
201 | local_irq_restore(flags); | 200 | local_irq_restore(flags); |
202 | 201 | ||
203 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 202 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
204 | 203 | ||
205 | return 0; | 204 | return 0; |
206 | } | 205 | } |
diff --git a/arch/arm/mach-s3c24xx/cpufreq.c b/arch/arm/mach-s3c24xx/cpufreq.c index 5f181e733eee..3c0e78ede0da 100644 --- a/arch/arm/mach-s3c24xx/cpufreq.c +++ b/arch/arm/mach-s3c24xx/cpufreq.c | |||
@@ -204,7 +204,6 @@ static int s3c_cpufreq_settarget(struct cpufreq_policy *policy, | |||
204 | freqs.old = cpu_cur.freq; | 204 | freqs.old = cpu_cur.freq; |
205 | freqs.new = cpu_new.freq; | 205 | freqs.new = cpu_new.freq; |
206 | 206 | ||
207 | freqs.freqs.cpu = 0; | ||
208 | freqs.freqs.old = cpu_cur.freq.armclk / 1000; | 207 | freqs.freqs.old = cpu_cur.freq.armclk / 1000; |
209 | freqs.freqs.new = cpu_new.freq.armclk / 1000; | 208 | freqs.freqs.new = cpu_new.freq.armclk / 1000; |
210 | 209 | ||
@@ -218,9 +217,7 @@ static int s3c_cpufreq_settarget(struct cpufreq_policy *policy, | |||
218 | s3c_cpufreq_updateclk(clk_pclk, cpu_new.freq.pclk); | 217 | s3c_cpufreq_updateclk(clk_pclk, cpu_new.freq.pclk); |
219 | 218 | ||
220 | /* start the frequency change */ | 219 | /* start the frequency change */ |
221 | 220 | cpufreq_notify_transition(policy, &freqs.freqs, CPUFREQ_PRECHANGE); | |
222 | if (policy) | ||
223 | cpufreq_notify_transition(&freqs.freqs, CPUFREQ_PRECHANGE); | ||
224 | 221 | ||
225 | /* If hclk is staying the same, then we do not need to | 222 | /* If hclk is staying the same, then we do not need to |
226 | * re-write the IO or the refresh timings whilst we are changing | 223 | * re-write the IO or the refresh timings whilst we are changing |
@@ -264,8 +261,7 @@ static int s3c_cpufreq_settarget(struct cpufreq_policy *policy, | |||
264 | local_irq_restore(flags); | 261 | local_irq_restore(flags); |
265 | 262 | ||
266 | /* notify everyone we've done this */ | 263 | /* notify everyone we've done this */ |
267 | if (policy) | 264 | cpufreq_notify_transition(policy, &freqs.freqs, CPUFREQ_POSTCHANGE); |
268 | cpufreq_notify_transition(&freqs.freqs, CPUFREQ_POSTCHANGE); | ||
269 | 265 | ||
270 | s3c_freq_dbg("%s: finished\n", __func__); | 266 | s3c_freq_dbg("%s: finished\n", __func__); |
271 | return 0; | 267 | return 0; |
diff --git a/arch/arm/mach-sa1100/cpu-sa1100.c b/arch/arm/mach-sa1100/cpu-sa1100.c index e8f4d1e19233..32687617c7a5 100644 --- a/arch/arm/mach-sa1100/cpu-sa1100.c +++ b/arch/arm/mach-sa1100/cpu-sa1100.c | |||
@@ -201,9 +201,8 @@ static int sa1100_target(struct cpufreq_policy *policy, | |||
201 | 201 | ||
202 | freqs.old = cur; | 202 | freqs.old = cur; |
203 | freqs.new = sa11x0_ppcr_to_freq(new_ppcr); | 203 | freqs.new = sa11x0_ppcr_to_freq(new_ppcr); |
204 | freqs.cpu = 0; | ||
205 | 204 | ||
206 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 205 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
207 | 206 | ||
208 | if (freqs.new > cur) | 207 | if (freqs.new > cur) |
209 | sa1100_update_dram_timings(cur, freqs.new); | 208 | sa1100_update_dram_timings(cur, freqs.new); |
@@ -213,7 +212,7 @@ static int sa1100_target(struct cpufreq_policy *policy, | |||
213 | if (freqs.new < cur) | 212 | if (freqs.new < cur) |
214 | sa1100_update_dram_timings(cur, freqs.new); | 213 | sa1100_update_dram_timings(cur, freqs.new); |
215 | 214 | ||
216 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 215 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
217 | 216 | ||
218 | return 0; | 217 | return 0; |
219 | } | 218 | } |
diff --git a/arch/arm/mach-sa1100/cpu-sa1110.c b/arch/arm/mach-sa1100/cpu-sa1110.c index 48c45b0c92bb..38a77330dc16 100644 --- a/arch/arm/mach-sa1100/cpu-sa1110.c +++ b/arch/arm/mach-sa1100/cpu-sa1110.c | |||
@@ -258,7 +258,6 @@ static int sa1110_target(struct cpufreq_policy *policy, | |||
258 | 258 | ||
259 | freqs.old = sa11x0_getspeed(0); | 259 | freqs.old = sa11x0_getspeed(0); |
260 | freqs.new = sa11x0_ppcr_to_freq(ppcr); | 260 | freqs.new = sa11x0_ppcr_to_freq(ppcr); |
261 | freqs.cpu = 0; | ||
262 | 261 | ||
263 | sdram_calculate_timing(&sd, freqs.new, sdram); | 262 | sdram_calculate_timing(&sd, freqs.new, sdram); |
264 | 263 | ||
@@ -279,7 +278,7 @@ static int sa1110_target(struct cpufreq_policy *policy, | |||
279 | sd.mdcas[2] = 0xaaaaaaaa; | 278 | sd.mdcas[2] = 0xaaaaaaaa; |
280 | #endif | 279 | #endif |
281 | 280 | ||
282 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 281 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
283 | 282 | ||
284 | /* | 283 | /* |
285 | * The clock could be going away for some time. Set the SDRAMs | 284 | * The clock could be going away for some time. Set the SDRAMs |
@@ -327,7 +326,7 @@ static int sa1110_target(struct cpufreq_policy *policy, | |||
327 | */ | 326 | */ |
328 | sdram_update_refresh(freqs.new, sdram); | 327 | sdram_update_refresh(freqs.new, sdram); |
329 | 328 | ||
330 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 329 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
331 | 330 | ||
332 | return 0; | 331 | return 0; |
333 | } | 332 | } |
diff --git a/arch/arm/mach-tegra/cpu-tegra.c b/arch/arm/mach-tegra/cpu-tegra.c index e3d6e15ff188..11ca730970f8 100644 --- a/arch/arm/mach-tegra/cpu-tegra.c +++ b/arch/arm/mach-tegra/cpu-tegra.c | |||
@@ -106,7 +106,8 @@ out: | |||
106 | return ret; | 106 | return ret; |
107 | } | 107 | } |
108 | 108 | ||
109 | static int tegra_update_cpu_speed(unsigned long rate) | 109 | static int tegra_update_cpu_speed(struct cpufreq_policy *policy, |
110 | unsigned long rate) | ||
110 | { | 111 | { |
111 | int ret = 0; | 112 | int ret = 0; |
112 | struct cpufreq_freqs freqs; | 113 | struct cpufreq_freqs freqs; |
@@ -128,8 +129,7 @@ static int tegra_update_cpu_speed(unsigned long rate) | |||
128 | else | 129 | else |
129 | clk_set_rate(emc_clk, 100000000); /* emc 50Mhz */ | 130 | clk_set_rate(emc_clk, 100000000); /* emc 50Mhz */ |
130 | 131 | ||
131 | for_each_online_cpu(freqs.cpu) | 132 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
132 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
133 | 133 | ||
134 | #ifdef CONFIG_CPU_FREQ_DEBUG | 134 | #ifdef CONFIG_CPU_FREQ_DEBUG |
135 | printk(KERN_DEBUG "cpufreq-tegra: transition: %u --> %u\n", | 135 | printk(KERN_DEBUG "cpufreq-tegra: transition: %u --> %u\n", |
@@ -143,8 +143,7 @@ static int tegra_update_cpu_speed(unsigned long rate) | |||
143 | return ret; | 143 | return ret; |
144 | } | 144 | } |
145 | 145 | ||
146 | for_each_online_cpu(freqs.cpu) | 146 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
147 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
148 | 147 | ||
149 | return 0; | 148 | return 0; |
150 | } | 149 | } |
@@ -181,7 +180,7 @@ static int tegra_target(struct cpufreq_policy *policy, | |||
181 | 180 | ||
182 | target_cpu_speed[policy->cpu] = freq; | 181 | target_cpu_speed[policy->cpu] = freq; |
183 | 182 | ||
184 | ret = tegra_update_cpu_speed(tegra_cpu_highest_speed()); | 183 | ret = tegra_update_cpu_speed(policy, tegra_cpu_highest_speed()); |
185 | 184 | ||
186 | out: | 185 | out: |
187 | mutex_unlock(&tegra_cpu_lock); | 186 | mutex_unlock(&tegra_cpu_lock); |
@@ -193,10 +192,12 @@ static int tegra_pm_notify(struct notifier_block *nb, unsigned long event, | |||
193 | { | 192 | { |
194 | mutex_lock(&tegra_cpu_lock); | 193 | mutex_lock(&tegra_cpu_lock); |
195 | if (event == PM_SUSPEND_PREPARE) { | 194 | if (event == PM_SUSPEND_PREPARE) { |
195 | struct cpufreq_policy *policy = cpufreq_cpu_get(0); | ||
196 | is_suspended = true; | 196 | is_suspended = true; |
197 | pr_info("Tegra cpufreq suspend: setting frequency to %d kHz\n", | 197 | pr_info("Tegra cpufreq suspend: setting frequency to %d kHz\n", |
198 | freq_table[0].frequency); | 198 | freq_table[0].frequency); |
199 | tegra_update_cpu_speed(freq_table[0].frequency); | 199 | tegra_update_cpu_speed(policy, freq_table[0].frequency); |
200 | cpufreq_cpu_put(policy); | ||
200 | } else if (event == PM_POST_SUSPEND) { | 201 | } else if (event == PM_POST_SUSPEND) { |
201 | is_suspended = false; | 202 | is_suspended = false; |
202 | } | 203 | } |
diff --git a/arch/avr32/mach-at32ap/cpufreq.c b/arch/avr32/mach-at32ap/cpufreq.c index 18b765629a0c..654488723cb5 100644 --- a/arch/avr32/mach-at32ap/cpufreq.c +++ b/arch/avr32/mach-at32ap/cpufreq.c | |||
@@ -61,7 +61,6 @@ static int at32_set_target(struct cpufreq_policy *policy, | |||
61 | 61 | ||
62 | freqs.old = at32_get_speed(0); | 62 | freqs.old = at32_get_speed(0); |
63 | freqs.new = (freq + 500) / 1000; | 63 | freqs.new = (freq + 500) / 1000; |
64 | freqs.cpu = 0; | ||
65 | freqs.flags = 0; | 64 | freqs.flags = 0; |
66 | 65 | ||
67 | if (!ref_freq) { | 66 | if (!ref_freq) { |
@@ -69,7 +68,7 @@ static int at32_set_target(struct cpufreq_policy *policy, | |||
69 | loops_per_jiffy_ref = boot_cpu_data.loops_per_jiffy; | 68 | loops_per_jiffy_ref = boot_cpu_data.loops_per_jiffy; |
70 | } | 69 | } |
71 | 70 | ||
72 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 71 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
73 | if (freqs.old < freqs.new) | 72 | if (freqs.old < freqs.new) |
74 | boot_cpu_data.loops_per_jiffy = cpufreq_scale( | 73 | boot_cpu_data.loops_per_jiffy = cpufreq_scale( |
75 | loops_per_jiffy_ref, ref_freq, freqs.new); | 74 | loops_per_jiffy_ref, ref_freq, freqs.new); |
@@ -77,7 +76,7 @@ static int at32_set_target(struct cpufreq_policy *policy, | |||
77 | if (freqs.new < freqs.old) | 76 | if (freqs.new < freqs.old) |
78 | boot_cpu_data.loops_per_jiffy = cpufreq_scale( | 77 | boot_cpu_data.loops_per_jiffy = cpufreq_scale( |
79 | loops_per_jiffy_ref, ref_freq, freqs.new); | 78 | loops_per_jiffy_ref, ref_freq, freqs.new); |
80 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 79 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
81 | 80 | ||
82 | pr_debug("cpufreq: set frequency %lu Hz\n", freq); | 81 | pr_debug("cpufreq: set frequency %lu Hz\n", freq); |
83 | 82 | ||
diff --git a/arch/blackfin/mach-common/cpufreq.c b/arch/blackfin/mach-common/cpufreq.c index d88bd31319e6..995511e80bef 100644 --- a/arch/blackfin/mach-common/cpufreq.c +++ b/arch/blackfin/mach-common/cpufreq.c | |||
@@ -127,13 +127,13 @@ unsigned long cpu_set_cclk(int cpu, unsigned long new) | |||
127 | } | 127 | } |
128 | #endif | 128 | #endif |
129 | 129 | ||
130 | static int bfin_target(struct cpufreq_policy *poli, | 130 | static int bfin_target(struct cpufreq_policy *policy, |
131 | unsigned int target_freq, unsigned int relation) | 131 | unsigned int target_freq, unsigned int relation) |
132 | { | 132 | { |
133 | #ifndef CONFIG_BF60x | 133 | #ifndef CONFIG_BF60x |
134 | unsigned int plldiv; | 134 | unsigned int plldiv; |
135 | #endif | 135 | #endif |
136 | unsigned int index, cpu; | 136 | unsigned int index; |
137 | unsigned long cclk_hz; | 137 | unsigned long cclk_hz; |
138 | struct cpufreq_freqs freqs; | 138 | struct cpufreq_freqs freqs; |
139 | static unsigned long lpj_ref; | 139 | static unsigned long lpj_ref; |
@@ -144,59 +144,48 @@ static int bfin_target(struct cpufreq_policy *poli, | |||
144 | cycles_t cycles; | 144 | cycles_t cycles; |
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | for_each_online_cpu(cpu) { | 147 | if (cpufreq_frequency_table_target(policy, bfin_freq_table, target_freq, |
148 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); | 148 | relation, &index)) |
149 | return -EINVAL; | ||
149 | 150 | ||
150 | if (!policy) | 151 | cclk_hz = bfin_freq_table[index].frequency; |
151 | continue; | ||
152 | 152 | ||
153 | if (cpufreq_frequency_table_target(policy, bfin_freq_table, | 153 | freqs.old = bfin_getfreq_khz(0); |
154 | target_freq, relation, &index)) | 154 | freqs.new = cclk_hz; |
155 | return -EINVAL; | ||
156 | 155 | ||
157 | cclk_hz = bfin_freq_table[index].frequency; | 156 | pr_debug("cpufreq: changing cclk to %lu; target = %u, oldfreq = %u\n", |
157 | cclk_hz, target_freq, freqs.old); | ||
158 | 158 | ||
159 | freqs.old = bfin_getfreq_khz(0); | 159 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
160 | freqs.new = cclk_hz; | ||
161 | freqs.cpu = cpu; | ||
162 | |||
163 | pr_debug("cpufreq: changing cclk to %lu; target = %u, oldfreq = %u\n", | ||
164 | cclk_hz, target_freq, freqs.old); | ||
165 | |||
166 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
167 | if (cpu == CPUFREQ_CPU) { | ||
168 | #ifndef CONFIG_BF60x | 160 | #ifndef CONFIG_BF60x |
169 | plldiv = (bfin_read_PLL_DIV() & SSEL) | | 161 | plldiv = (bfin_read_PLL_DIV() & SSEL) | dpm_state_table[index].csel; |
170 | dpm_state_table[index].csel; | 162 | bfin_write_PLL_DIV(plldiv); |
171 | bfin_write_PLL_DIV(plldiv); | ||
172 | #else | 163 | #else |
173 | ret = cpu_set_cclk(cpu, freqs.new * 1000); | 164 | ret = cpu_set_cclk(policy->cpu, freqs.new * 1000); |
174 | if (ret != 0) { | 165 | if (ret != 0) { |
175 | WARN_ONCE(ret, "cpufreq set freq failed %d\n", ret); | 166 | WARN_ONCE(ret, "cpufreq set freq failed %d\n", ret); |
176 | break; | 167 | return ret; |
177 | } | 168 | } |
178 | #endif | 169 | #endif |
179 | on_each_cpu(bfin_adjust_core_timer, &index, 1); | 170 | on_each_cpu(bfin_adjust_core_timer, &index, 1); |
180 | #if defined(CONFIG_CYCLES_CLOCKSOURCE) | 171 | #if defined(CONFIG_CYCLES_CLOCKSOURCE) |
181 | cycles = get_cycles(); | 172 | cycles = get_cycles(); |
182 | SSYNC(); | 173 | SSYNC(); |
183 | cycles += 10; /* ~10 cycles we lose after get_cycles() */ | 174 | cycles += 10; /* ~10 cycles we lose after get_cycles() */ |
184 | __bfin_cycles_off += | 175 | __bfin_cycles_off += (cycles << __bfin_cycles_mod) - (cycles << index); |
185 | (cycles << __bfin_cycles_mod) - (cycles << index); | 176 | __bfin_cycles_mod = index; |
186 | __bfin_cycles_mod = index; | ||
187 | #endif | 177 | #endif |
188 | if (!lpj_ref_freq) { | 178 | if (!lpj_ref_freq) { |
189 | lpj_ref = loops_per_jiffy; | 179 | lpj_ref = loops_per_jiffy; |
190 | lpj_ref_freq = freqs.old; | 180 | lpj_ref_freq = freqs.old; |
191 | } | ||
192 | if (freqs.new != freqs.old) { | ||
193 | loops_per_jiffy = cpufreq_scale(lpj_ref, | ||
194 | lpj_ref_freq, freqs.new); | ||
195 | } | ||
196 | } | ||
197 | /* TODO: just test case for cycles clock source, remove later */ | ||
198 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
199 | } | 181 | } |
182 | if (freqs.new != freqs.old) { | ||
183 | loops_per_jiffy = cpufreq_scale(lpj_ref, | ||
184 | lpj_ref_freq, freqs.new); | ||
185 | } | ||
186 | |||
187 | /* TODO: just test case for cycles clock source, remove later */ | ||
188 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); | ||
200 | 189 | ||
201 | pr_debug("cpufreq: done\n"); | 190 | pr_debug("cpufreq: done\n"); |
202 | return ret; | 191 | return ret; |
diff --git a/arch/cris/arch-v32/mach-a3/cpufreq.c b/arch/cris/arch-v32/mach-a3/cpufreq.c index ee391ecb5bc9..ee142c490575 100644 --- a/arch/cris/arch-v32/mach-a3/cpufreq.c +++ b/arch/cris/arch-v32/mach-a3/cpufreq.c | |||
@@ -27,23 +27,17 @@ static unsigned int cris_freq_get_cpu_frequency(unsigned int cpu) | |||
27 | return clk_ctrl.pll ? 200000 : 6000; | 27 | return clk_ctrl.pll ? 200000 : 6000; |
28 | } | 28 | } |
29 | 29 | ||
30 | static void cris_freq_set_cpu_state(unsigned int state) | 30 | static void cris_freq_set_cpu_state(struct cpufreq_policy *policy, |
31 | unsigned int state) | ||
31 | { | 32 | { |
32 | int i = 0; | ||
33 | struct cpufreq_freqs freqs; | 33 | struct cpufreq_freqs freqs; |
34 | reg_clkgen_rw_clk_ctrl clk_ctrl; | 34 | reg_clkgen_rw_clk_ctrl clk_ctrl; |
35 | clk_ctrl = REG_RD(clkgen, regi_clkgen, rw_clk_ctrl); | 35 | clk_ctrl = REG_RD(clkgen, regi_clkgen, rw_clk_ctrl); |
36 | 36 | ||
37 | #ifdef CONFIG_SMP | 37 | freqs.old = cris_freq_get_cpu_frequency(policy->cpu); |
38 | for_each_present_cpu(i) | 38 | freqs.new = cris_freq_table[state].frequency; |
39 | #endif | ||
40 | { | ||
41 | freqs.old = cris_freq_get_cpu_frequency(i); | ||
42 | freqs.new = cris_freq_table[state].frequency; | ||
43 | freqs.cpu = i; | ||
44 | } | ||
45 | 39 | ||
46 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 40 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
47 | 41 | ||
48 | local_irq_disable(); | 42 | local_irq_disable(); |
49 | 43 | ||
@@ -57,7 +51,7 @@ static void cris_freq_set_cpu_state(unsigned int state) | |||
57 | 51 | ||
58 | local_irq_enable(); | 52 | local_irq_enable(); |
59 | 53 | ||
60 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 54 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
61 | }; | 55 | }; |
62 | 56 | ||
63 | static int cris_freq_verify(struct cpufreq_policy *policy) | 57 | static int cris_freq_verify(struct cpufreq_policy *policy) |
@@ -75,7 +69,7 @@ static int cris_freq_target(struct cpufreq_policy *policy, | |||
75 | target_freq, relation, &newstate)) | 69 | target_freq, relation, &newstate)) |
76 | return -EINVAL; | 70 | return -EINVAL; |
77 | 71 | ||
78 | cris_freq_set_cpu_state(newstate); | 72 | cris_freq_set_cpu_state(policy, newstate); |
79 | 73 | ||
80 | return 0; | 74 | return 0; |
81 | } | 75 | } |
diff --git a/arch/cris/arch-v32/mach-fs/cpufreq.c b/arch/cris/arch-v32/mach-fs/cpufreq.c index d92cf70d1cbe..12952235d5db 100644 --- a/arch/cris/arch-v32/mach-fs/cpufreq.c +++ b/arch/cris/arch-v32/mach-fs/cpufreq.c | |||
@@ -27,20 +27,17 @@ static unsigned int cris_freq_get_cpu_frequency(unsigned int cpu) | |||
27 | return clk_ctrl.pll ? 200000 : 6000; | 27 | return clk_ctrl.pll ? 200000 : 6000; |
28 | } | 28 | } |
29 | 29 | ||
30 | static void cris_freq_set_cpu_state(unsigned int state) | 30 | static void cris_freq_set_cpu_state(struct cpufreq_policy *policy, |
31 | unsigned int state) | ||
31 | { | 32 | { |
32 | int i; | ||
33 | struct cpufreq_freqs freqs; | 33 | struct cpufreq_freqs freqs; |
34 | reg_config_rw_clk_ctrl clk_ctrl; | 34 | reg_config_rw_clk_ctrl clk_ctrl; |
35 | clk_ctrl = REG_RD(config, regi_config, rw_clk_ctrl); | 35 | clk_ctrl = REG_RD(config, regi_config, rw_clk_ctrl); |
36 | 36 | ||
37 | for_each_possible_cpu(i) { | 37 | freqs.old = cris_freq_get_cpu_frequency(policy->cpu); |
38 | freqs.old = cris_freq_get_cpu_frequency(i); | 38 | freqs.new = cris_freq_table[state].frequency; |
39 | freqs.new = cris_freq_table[state].frequency; | ||
40 | freqs.cpu = i; | ||
41 | } | ||
42 | 39 | ||
43 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 40 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
44 | 41 | ||
45 | local_irq_disable(); | 42 | local_irq_disable(); |
46 | 43 | ||
@@ -54,7 +51,7 @@ static void cris_freq_set_cpu_state(unsigned int state) | |||
54 | 51 | ||
55 | local_irq_enable(); | 52 | local_irq_enable(); |
56 | 53 | ||
57 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 54 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
58 | }; | 55 | }; |
59 | 56 | ||
60 | static int cris_freq_verify(struct cpufreq_policy *policy) | 57 | static int cris_freq_verify(struct cpufreq_policy *policy) |
@@ -71,7 +68,7 @@ static int cris_freq_target(struct cpufreq_policy *policy, | |||
71 | (policy, cris_freq_table, target_freq, relation, &newstate)) | 68 | (policy, cris_freq_table, target_freq, relation, &newstate)) |
72 | return -EINVAL; | 69 | return -EINVAL; |
73 | 70 | ||
74 | cris_freq_set_cpu_state(newstate); | 71 | cris_freq_set_cpu_state(policy, newstate); |
75 | 72 | ||
76 | return 0; | 73 | return 0; |
77 | } | 74 | } |
diff --git a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c index f09b174244d5..4700fef8d1fa 100644 --- a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c +++ b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c | |||
@@ -137,7 +137,7 @@ migrate_end: | |||
137 | static int | 137 | static int |
138 | processor_set_freq ( | 138 | processor_set_freq ( |
139 | struct cpufreq_acpi_io *data, | 139 | struct cpufreq_acpi_io *data, |
140 | unsigned int cpu, | 140 | struct cpufreq_policy *policy, |
141 | int state) | 141 | int state) |
142 | { | 142 | { |
143 | int ret = 0; | 143 | int ret = 0; |
@@ -149,8 +149,8 @@ processor_set_freq ( | |||
149 | pr_debug("processor_set_freq\n"); | 149 | pr_debug("processor_set_freq\n"); |
150 | 150 | ||
151 | saved_mask = current->cpus_allowed; | 151 | saved_mask = current->cpus_allowed; |
152 | set_cpus_allowed_ptr(current, cpumask_of(cpu)); | 152 | set_cpus_allowed_ptr(current, cpumask_of(policy->cpu)); |
153 | if (smp_processor_id() != cpu) { | 153 | if (smp_processor_id() != policy->cpu) { |
154 | retval = -EAGAIN; | 154 | retval = -EAGAIN; |
155 | goto migrate_end; | 155 | goto migrate_end; |
156 | } | 156 | } |
@@ -170,12 +170,11 @@ processor_set_freq ( | |||
170 | data->acpi_data.state, state); | 170 | data->acpi_data.state, state); |
171 | 171 | ||
172 | /* cpufreq frequency struct */ | 172 | /* cpufreq frequency struct */ |
173 | cpufreq_freqs.cpu = cpu; | ||
174 | cpufreq_freqs.old = data->freq_table[data->acpi_data.state].frequency; | 173 | cpufreq_freqs.old = data->freq_table[data->acpi_data.state].frequency; |
175 | cpufreq_freqs.new = data->freq_table[state].frequency; | 174 | cpufreq_freqs.new = data->freq_table[state].frequency; |
176 | 175 | ||
177 | /* notify cpufreq */ | 176 | /* notify cpufreq */ |
178 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE); | 177 | cpufreq_notify_transition(policy, &cpufreq_freqs, CPUFREQ_PRECHANGE); |
179 | 178 | ||
180 | /* | 179 | /* |
181 | * First we write the target state's 'control' value to the | 180 | * First we write the target state's 'control' value to the |
@@ -189,17 +188,20 @@ processor_set_freq ( | |||
189 | ret = processor_set_pstate(value); | 188 | ret = processor_set_pstate(value); |
190 | if (ret) { | 189 | if (ret) { |
191 | unsigned int tmp = cpufreq_freqs.new; | 190 | unsigned int tmp = cpufreq_freqs.new; |
192 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); | 191 | cpufreq_notify_transition(policy, &cpufreq_freqs, |
192 | CPUFREQ_POSTCHANGE); | ||
193 | cpufreq_freqs.new = cpufreq_freqs.old; | 193 | cpufreq_freqs.new = cpufreq_freqs.old; |
194 | cpufreq_freqs.old = tmp; | 194 | cpufreq_freqs.old = tmp; |
195 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE); | 195 | cpufreq_notify_transition(policy, &cpufreq_freqs, |
196 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); | 196 | CPUFREQ_PRECHANGE); |
197 | cpufreq_notify_transition(policy, &cpufreq_freqs, | ||
198 | CPUFREQ_POSTCHANGE); | ||
197 | printk(KERN_WARNING "Transition failed with error %d\n", ret); | 199 | printk(KERN_WARNING "Transition failed with error %d\n", ret); |
198 | retval = -ENODEV; | 200 | retval = -ENODEV; |
199 | goto migrate_end; | 201 | goto migrate_end; |
200 | } | 202 | } |
201 | 203 | ||
202 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); | 204 | cpufreq_notify_transition(policy, &cpufreq_freqs, CPUFREQ_POSTCHANGE); |
203 | 205 | ||
204 | data->acpi_data.state = state; | 206 | data->acpi_data.state = state; |
205 | 207 | ||
@@ -240,7 +242,7 @@ acpi_cpufreq_target ( | |||
240 | if (result) | 242 | if (result) |
241 | return (result); | 243 | return (result); |
242 | 244 | ||
243 | result = processor_set_freq(data, policy->cpu, next_state); | 245 | result = processor_set_freq(data, policy, next_state); |
244 | 246 | ||
245 | return (result); | 247 | return (result); |
246 | } | 248 | } |
diff --git a/arch/mips/kernel/cpufreq/loongson2_cpufreq.c b/arch/mips/kernel/cpufreq/loongson2_cpufreq.c index 3237c5235f9c..bafda7063f03 100644 --- a/arch/mips/kernel/cpufreq/loongson2_cpufreq.c +++ b/arch/mips/kernel/cpufreq/loongson2_cpufreq.c | |||
@@ -80,7 +80,6 @@ static int loongson2_cpufreq_target(struct cpufreq_policy *policy, | |||
80 | 80 | ||
81 | pr_debug("cpufreq: requested frequency %u Hz\n", target_freq * 1000); | 81 | pr_debug("cpufreq: requested frequency %u Hz\n", target_freq * 1000); |
82 | 82 | ||
83 | freqs.cpu = cpu; | ||
84 | freqs.old = loongson2_cpufreq_get(cpu); | 83 | freqs.old = loongson2_cpufreq_get(cpu); |
85 | freqs.new = freq; | 84 | freqs.new = freq; |
86 | freqs.flags = 0; | 85 | freqs.flags = 0; |
@@ -89,7 +88,7 @@ static int loongson2_cpufreq_target(struct cpufreq_policy *policy, | |||
89 | return 0; | 88 | return 0; |
90 | 89 | ||
91 | /* notifiers */ | 90 | /* notifiers */ |
92 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 91 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
93 | 92 | ||
94 | set_cpus_allowed_ptr(current, &cpus_allowed); | 93 | set_cpus_allowed_ptr(current, &cpus_allowed); |
95 | 94 | ||
@@ -97,7 +96,7 @@ static int loongson2_cpufreq_target(struct cpufreq_policy *policy, | |||
97 | clk_set_rate(cpuclk, freq); | 96 | clk_set_rate(cpuclk, freq); |
98 | 97 | ||
99 | /* notifiers */ | 98 | /* notifiers */ |
100 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 99 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
101 | 100 | ||
102 | pr_debug("cpufreq: set frequency %u kHz\n", freq); | 101 | pr_debug("cpufreq: set frequency %u kHz\n", freq); |
103 | 102 | ||
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.c b/arch/powerpc/platforms/cell/cbe_cpufreq.c index d4c39e32f147..718c6a33023d 100644 --- a/arch/powerpc/platforms/cell/cbe_cpufreq.c +++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c | |||
@@ -156,10 +156,9 @@ static int cbe_cpufreq_target(struct cpufreq_policy *policy, | |||
156 | 156 | ||
157 | freqs.old = policy->cur; | 157 | freqs.old = policy->cur; |
158 | freqs.new = cbe_freqs[cbe_pmode_new].frequency; | 158 | freqs.new = cbe_freqs[cbe_pmode_new].frequency; |
159 | freqs.cpu = policy->cpu; | ||
160 | 159 | ||
161 | mutex_lock(&cbe_switch_mutex); | 160 | mutex_lock(&cbe_switch_mutex); |
162 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 161 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
163 | 162 | ||
164 | pr_debug("setting frequency for cpu %d to %d kHz, " \ | 163 | pr_debug("setting frequency for cpu %d to %d kHz, " \ |
165 | "1/%d of max frequency\n", | 164 | "1/%d of max frequency\n", |
@@ -169,7 +168,7 @@ static int cbe_cpufreq_target(struct cpufreq_policy *policy, | |||
169 | 168 | ||
170 | rc = set_pmode(policy->cpu, cbe_pmode_new); | 169 | rc = set_pmode(policy->cpu, cbe_pmode_new); |
171 | 170 | ||
172 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 171 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
173 | mutex_unlock(&cbe_switch_mutex); | 172 | mutex_unlock(&cbe_switch_mutex); |
174 | 173 | ||
175 | return rc; | 174 | return rc; |
diff --git a/arch/powerpc/platforms/pasemi/cpufreq.c b/arch/powerpc/platforms/pasemi/cpufreq.c index 890f30e70f98..be1e7958909e 100644 --- a/arch/powerpc/platforms/pasemi/cpufreq.c +++ b/arch/powerpc/platforms/pasemi/cpufreq.c | |||
@@ -273,10 +273,9 @@ static int pas_cpufreq_target(struct cpufreq_policy *policy, | |||
273 | 273 | ||
274 | freqs.old = policy->cur; | 274 | freqs.old = policy->cur; |
275 | freqs.new = pas_freqs[pas_astate_new].frequency; | 275 | freqs.new = pas_freqs[pas_astate_new].frequency; |
276 | freqs.cpu = policy->cpu; | ||
277 | 276 | ||
278 | mutex_lock(&pas_switch_mutex); | 277 | mutex_lock(&pas_switch_mutex); |
279 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 278 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
280 | 279 | ||
281 | pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n", | 280 | pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n", |
282 | policy->cpu, | 281 | policy->cpu, |
@@ -288,7 +287,7 @@ static int pas_cpufreq_target(struct cpufreq_policy *policy, | |||
288 | for_each_online_cpu(i) | 287 | for_each_online_cpu(i) |
289 | set_astate(i, pas_astate_new); | 288 | set_astate(i, pas_astate_new); |
290 | 289 | ||
291 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 290 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
292 | mutex_unlock(&pas_switch_mutex); | 291 | mutex_unlock(&pas_switch_mutex); |
293 | 292 | ||
294 | ppc_proc_freq = freqs.new * 1000ul; | 293 | ppc_proc_freq = freqs.new * 1000ul; |
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c index 311b804353b1..3104fad82480 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_32.c +++ b/arch/powerpc/platforms/powermac/cpufreq_32.c | |||
@@ -335,7 +335,8 @@ static int pmu_set_cpu_speed(int low_speed) | |||
335 | return 0; | 335 | return 0; |
336 | } | 336 | } |
337 | 337 | ||
338 | static int do_set_cpu_speed(int speed_mode, int notify) | 338 | static int do_set_cpu_speed(struct cpufreq_policy *policy, int speed_mode, |
339 | int notify) | ||
339 | { | 340 | { |
340 | struct cpufreq_freqs freqs; | 341 | struct cpufreq_freqs freqs; |
341 | unsigned long l3cr; | 342 | unsigned long l3cr; |
@@ -343,13 +344,12 @@ static int do_set_cpu_speed(int speed_mode, int notify) | |||
343 | 344 | ||
344 | freqs.old = cur_freq; | 345 | freqs.old = cur_freq; |
345 | freqs.new = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq; | 346 | freqs.new = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq; |
346 | freqs.cpu = smp_processor_id(); | ||
347 | 347 | ||
348 | if (freqs.old == freqs.new) | 348 | if (freqs.old == freqs.new) |
349 | return 0; | 349 | return 0; |
350 | 350 | ||
351 | if (notify) | 351 | if (notify) |
352 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 352 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
353 | if (speed_mode == CPUFREQ_LOW && | 353 | if (speed_mode == CPUFREQ_LOW && |
354 | cpu_has_feature(CPU_FTR_L3CR)) { | 354 | cpu_has_feature(CPU_FTR_L3CR)) { |
355 | l3cr = _get_L3CR(); | 355 | l3cr = _get_L3CR(); |
@@ -366,7 +366,7 @@ static int do_set_cpu_speed(int speed_mode, int notify) | |||
366 | _set_L3CR(prev_l3cr); | 366 | _set_L3CR(prev_l3cr); |
367 | } | 367 | } |
368 | if (notify) | 368 | if (notify) |
369 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 369 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
370 | cur_freq = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq; | 370 | cur_freq = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq; |
371 | 371 | ||
372 | return 0; | 372 | return 0; |
@@ -393,7 +393,7 @@ static int pmac_cpufreq_target( struct cpufreq_policy *policy, | |||
393 | target_freq, relation, &newstate)) | 393 | target_freq, relation, &newstate)) |
394 | return -EINVAL; | 394 | return -EINVAL; |
395 | 395 | ||
396 | rc = do_set_cpu_speed(newstate, 1); | 396 | rc = do_set_cpu_speed(policy, newstate, 1); |
397 | 397 | ||
398 | ppc_proc_freq = cur_freq * 1000ul; | 398 | ppc_proc_freq = cur_freq * 1000ul; |
399 | return rc; | 399 | return rc; |
@@ -442,7 +442,7 @@ static int pmac_cpufreq_suspend(struct cpufreq_policy *policy) | |||
442 | no_schedule = 1; | 442 | no_schedule = 1; |
443 | sleep_freq = cur_freq; | 443 | sleep_freq = cur_freq; |
444 | if (cur_freq == low_freq && !is_pmu_based) | 444 | if (cur_freq == low_freq && !is_pmu_based) |
445 | do_set_cpu_speed(CPUFREQ_HIGH, 0); | 445 | do_set_cpu_speed(policy, CPUFREQ_HIGH, 0); |
446 | return 0; | 446 | return 0; |
447 | } | 447 | } |
448 | 448 | ||
@@ -458,7 +458,7 @@ static int pmac_cpufreq_resume(struct cpufreq_policy *policy) | |||
458 | * is that we force a switch to whatever it was, which is | 458 | * is that we force a switch to whatever it was, which is |
459 | * probably high speed due to our suspend() routine | 459 | * probably high speed due to our suspend() routine |
460 | */ | 460 | */ |
461 | do_set_cpu_speed(sleep_freq == low_freq ? | 461 | do_set_cpu_speed(policy, sleep_freq == low_freq ? |
462 | CPUFREQ_LOW : CPUFREQ_HIGH, 0); | 462 | CPUFREQ_LOW : CPUFREQ_HIGH, 0); |
463 | 463 | ||
464 | ppc_proc_freq = cur_freq * 1000ul; | 464 | ppc_proc_freq = cur_freq * 1000ul; |
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c index 9650c6029c82..7ba423431cfe 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_64.c +++ b/arch/powerpc/platforms/powermac/cpufreq_64.c | |||
@@ -339,11 +339,10 @@ static int g5_cpufreq_target(struct cpufreq_policy *policy, | |||
339 | 339 | ||
340 | freqs.old = g5_cpu_freqs[g5_pmode_cur].frequency; | 340 | freqs.old = g5_cpu_freqs[g5_pmode_cur].frequency; |
341 | freqs.new = g5_cpu_freqs[newstate].frequency; | 341 | freqs.new = g5_cpu_freqs[newstate].frequency; |
342 | freqs.cpu = 0; | ||
343 | 342 | ||
344 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 343 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
345 | rc = g5_switch_freq(newstate); | 344 | rc = g5_switch_freq(newstate); |
346 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 345 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
347 | 346 | ||
348 | mutex_unlock(&g5_switch_mutex); | 347 | mutex_unlock(&g5_switch_mutex); |
349 | 348 | ||
diff --git a/arch/sh/kernel/cpufreq.c b/arch/sh/kernel/cpufreq.c index e68b45b6f3f9..2c7bd94f95ee 100644 --- a/arch/sh/kernel/cpufreq.c +++ b/arch/sh/kernel/cpufreq.c | |||
@@ -69,15 +69,14 @@ static int sh_cpufreq_target(struct cpufreq_policy *policy, | |||
69 | 69 | ||
70 | dev_dbg(dev, "requested frequency %u Hz\n", target_freq * 1000); | 70 | dev_dbg(dev, "requested frequency %u Hz\n", target_freq * 1000); |
71 | 71 | ||
72 | freqs.cpu = cpu; | ||
73 | freqs.old = sh_cpufreq_get(cpu); | 72 | freqs.old = sh_cpufreq_get(cpu); |
74 | freqs.new = (freq + 500) / 1000; | 73 | freqs.new = (freq + 500) / 1000; |
75 | freqs.flags = 0; | 74 | freqs.flags = 0; |
76 | 75 | ||
77 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 76 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
78 | set_cpus_allowed_ptr(current, &cpus_allowed); | 77 | set_cpus_allowed_ptr(current, &cpus_allowed); |
79 | clk_set_rate(cpuclk, freq); | 78 | clk_set_rate(cpuclk, freq); |
80 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 79 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
81 | 80 | ||
82 | dev_dbg(dev, "set frequency %lu Hz\n", freq); | 81 | dev_dbg(dev, "set frequency %lu Hz\n", freq); |
83 | 82 | ||
diff --git a/arch/sparc/kernel/us2e_cpufreq.c b/arch/sparc/kernel/us2e_cpufreq.c index 489fc15f3194..abe963d7b87c 100644 --- a/arch/sparc/kernel/us2e_cpufreq.c +++ b/arch/sparc/kernel/us2e_cpufreq.c | |||
@@ -248,8 +248,10 @@ static unsigned int us2e_freq_get(unsigned int cpu) | |||
248 | return clock_tick / estar_to_divisor(estar); | 248 | return clock_tick / estar_to_divisor(estar); |
249 | } | 249 | } |
250 | 250 | ||
251 | static void us2e_set_cpu_divider_index(unsigned int cpu, unsigned int index) | 251 | static void us2e_set_cpu_divider_index(struct cpufreq_policy *policy, |
252 | unsigned int index) | ||
252 | { | 253 | { |
254 | unsigned int cpu = policy->cpu; | ||
253 | unsigned long new_bits, new_freq; | 255 | unsigned long new_bits, new_freq; |
254 | unsigned long clock_tick, divisor, old_divisor, estar; | 256 | unsigned long clock_tick, divisor, old_divisor, estar; |
255 | cpumask_t cpus_allowed; | 257 | cpumask_t cpus_allowed; |
@@ -272,14 +274,13 @@ static void us2e_set_cpu_divider_index(unsigned int cpu, unsigned int index) | |||
272 | 274 | ||
273 | freqs.old = clock_tick / old_divisor; | 275 | freqs.old = clock_tick / old_divisor; |
274 | freqs.new = new_freq; | 276 | freqs.new = new_freq; |
275 | freqs.cpu = cpu; | 277 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
276 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
277 | 278 | ||
278 | if (old_divisor != divisor) | 279 | if (old_divisor != divisor) |
279 | us2e_transition(estar, new_bits, clock_tick * 1000, | 280 | us2e_transition(estar, new_bits, clock_tick * 1000, |
280 | old_divisor, divisor); | 281 | old_divisor, divisor); |
281 | 282 | ||
282 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 283 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
283 | 284 | ||
284 | set_cpus_allowed_ptr(current, &cpus_allowed); | 285 | set_cpus_allowed_ptr(current, &cpus_allowed); |
285 | } | 286 | } |
@@ -295,7 +296,7 @@ static int us2e_freq_target(struct cpufreq_policy *policy, | |||
295 | target_freq, relation, &new_index)) | 296 | target_freq, relation, &new_index)) |
296 | return -EINVAL; | 297 | return -EINVAL; |
297 | 298 | ||
298 | us2e_set_cpu_divider_index(policy->cpu, new_index); | 299 | us2e_set_cpu_divider_index(policy, new_index); |
299 | 300 | ||
300 | return 0; | 301 | return 0; |
301 | } | 302 | } |
@@ -335,7 +336,7 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy) | |||
335 | static int us2e_freq_cpu_exit(struct cpufreq_policy *policy) | 336 | static int us2e_freq_cpu_exit(struct cpufreq_policy *policy) |
336 | { | 337 | { |
337 | if (cpufreq_us2e_driver) | 338 | if (cpufreq_us2e_driver) |
338 | us2e_set_cpu_divider_index(policy->cpu, 0); | 339 | us2e_set_cpu_divider_index(policy, 0); |
339 | 340 | ||
340 | return 0; | 341 | return 0; |
341 | } | 342 | } |
diff --git a/arch/sparc/kernel/us3_cpufreq.c b/arch/sparc/kernel/us3_cpufreq.c index eb1624b931d9..7ceb9c8458f0 100644 --- a/arch/sparc/kernel/us3_cpufreq.c +++ b/arch/sparc/kernel/us3_cpufreq.c | |||
@@ -96,8 +96,10 @@ static unsigned int us3_freq_get(unsigned int cpu) | |||
96 | return ret; | 96 | return ret; |
97 | } | 97 | } |
98 | 98 | ||
99 | static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index) | 99 | static void us3_set_cpu_divider_index(struct cpufreq_policy *policy, |
100 | unsigned int index) | ||
100 | { | 101 | { |
102 | unsigned int cpu = policy->cpu; | ||
101 | unsigned long new_bits, new_freq, reg; | 103 | unsigned long new_bits, new_freq, reg; |
102 | cpumask_t cpus_allowed; | 104 | cpumask_t cpus_allowed; |
103 | struct cpufreq_freqs freqs; | 105 | struct cpufreq_freqs freqs; |
@@ -131,14 +133,13 @@ static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index) | |||
131 | 133 | ||
132 | freqs.old = get_current_freq(cpu, reg); | 134 | freqs.old = get_current_freq(cpu, reg); |
133 | freqs.new = new_freq; | 135 | freqs.new = new_freq; |
134 | freqs.cpu = cpu; | 136 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
135 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
136 | 137 | ||
137 | reg &= ~SAFARI_CFG_DIV_MASK; | 138 | reg &= ~SAFARI_CFG_DIV_MASK; |
138 | reg |= new_bits; | 139 | reg |= new_bits; |
139 | write_safari_cfg(reg); | 140 | write_safari_cfg(reg); |
140 | 141 | ||
141 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 142 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
142 | 143 | ||
143 | set_cpus_allowed_ptr(current, &cpus_allowed); | 144 | set_cpus_allowed_ptr(current, &cpus_allowed); |
144 | } | 145 | } |
@@ -156,7 +157,7 @@ static int us3_freq_target(struct cpufreq_policy *policy, | |||
156 | &new_index)) | 157 | &new_index)) |
157 | return -EINVAL; | 158 | return -EINVAL; |
158 | 159 | ||
159 | us3_set_cpu_divider_index(policy->cpu, new_index); | 160 | us3_set_cpu_divider_index(policy, new_index); |
160 | 161 | ||
161 | return 0; | 162 | return 0; |
162 | } | 163 | } |
@@ -192,7 +193,7 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy) | |||
192 | static int us3_freq_cpu_exit(struct cpufreq_policy *policy) | 193 | static int us3_freq_cpu_exit(struct cpufreq_policy *policy) |
193 | { | 194 | { |
194 | if (cpufreq_us3_driver) | 195 | if (cpufreq_us3_driver) |
195 | us3_set_cpu_divider_index(policy->cpu, 0); | 196 | us3_set_cpu_divider_index(policy, 0); |
196 | 197 | ||
197 | return 0; | 198 | return 0; |
198 | } | 199 | } |
diff --git a/arch/unicore32/kernel/cpu-ucv2.c b/arch/unicore32/kernel/cpu-ucv2.c index 4a99f62584c7..ba5a71ce2d71 100644 --- a/arch/unicore32/kernel/cpu-ucv2.c +++ b/arch/unicore32/kernel/cpu-ucv2.c | |||
@@ -52,15 +52,14 @@ static int ucv2_target(struct cpufreq_policy *policy, | |||
52 | struct cpufreq_freqs freqs; | 52 | struct cpufreq_freqs freqs; |
53 | struct clk *mclk = clk_get(NULL, "MAIN_CLK"); | 53 | struct clk *mclk = clk_get(NULL, "MAIN_CLK"); |
54 | 54 | ||
55 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 55 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
56 | 56 | ||
57 | if (!clk_set_rate(mclk, target_freq * 1000)) { | 57 | if (!clk_set_rate(mclk, target_freq * 1000)) { |
58 | freqs.old = cur; | 58 | freqs.old = cur; |
59 | freqs.new = target_freq; | 59 | freqs.new = target_freq; |
60 | freqs.cpu = 0; | ||
61 | } | 60 | } |
62 | 61 | ||
63 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 62 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
64 | 63 | ||
65 | return 0; | 64 | return 0; |
66 | } | 65 | } |
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 57a8774f0b4e..11b8b4b54ceb 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c | |||
@@ -423,7 +423,6 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy, | |||
423 | struct drv_cmd cmd; | 423 | struct drv_cmd cmd; |
424 | unsigned int next_state = 0; /* Index into freq_table */ | 424 | unsigned int next_state = 0; /* Index into freq_table */ |
425 | unsigned int next_perf_state = 0; /* Index into perf table */ | 425 | unsigned int next_perf_state = 0; /* Index into perf table */ |
426 | unsigned int i; | ||
427 | int result = 0; | 426 | int result = 0; |
428 | 427 | ||
429 | pr_debug("acpi_cpufreq_target %d (%d)\n", target_freq, policy->cpu); | 428 | pr_debug("acpi_cpufreq_target %d (%d)\n", target_freq, policy->cpu); |
@@ -486,10 +485,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy, | |||
486 | 485 | ||
487 | freqs.old = perf->states[perf->state].core_frequency * 1000; | 486 | freqs.old = perf->states[perf->state].core_frequency * 1000; |
488 | freqs.new = data->freq_table[next_state].frequency; | 487 | freqs.new = data->freq_table[next_state].frequency; |
489 | for_each_cpu(i, policy->cpus) { | 488 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
490 | freqs.cpu = i; | ||
491 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
492 | } | ||
493 | 489 | ||
494 | drv_write(&cmd); | 490 | drv_write(&cmd); |
495 | 491 | ||
@@ -502,10 +498,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy, | |||
502 | } | 498 | } |
503 | } | 499 | } |
504 | 500 | ||
505 | for_each_cpu(i, policy->cpus) { | 501 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
506 | freqs.cpu = i; | ||
507 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
508 | } | ||
509 | perf->state = next_perf_state; | 502 | perf->state = next_perf_state; |
510 | 503 | ||
511 | out: | 504 | out: |
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index a7e51bd20502..65618536abfa 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c | |||
@@ -46,7 +46,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, | |||
46 | struct opp *opp; | 46 | struct opp *opp; |
47 | unsigned long volt = 0, volt_old = 0, tol = 0; | 47 | unsigned long volt = 0, volt_old = 0, tol = 0; |
48 | long freq_Hz; | 48 | long freq_Hz; |
49 | unsigned int index, cpu; | 49 | unsigned int index; |
50 | int ret; | 50 | int ret; |
51 | 51 | ||
52 | ret = cpufreq_frequency_table_target(policy, freq_table, target_freq, | 52 | ret = cpufreq_frequency_table_target(policy, freq_table, target_freq, |
@@ -66,10 +66,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, | |||
66 | if (freqs.old == freqs.new) | 66 | if (freqs.old == freqs.new) |
67 | return 0; | 67 | return 0; |
68 | 68 | ||
69 | for_each_online_cpu(cpu) { | 69 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
70 | freqs.cpu = cpu; | ||
71 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
72 | } | ||
73 | 70 | ||
74 | if (cpu_reg) { | 71 | if (cpu_reg) { |
75 | rcu_read_lock(); | 72 | rcu_read_lock(); |
@@ -121,10 +118,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, | |||
121 | } | 118 | } |
122 | 119 | ||
123 | post_notify: | 120 | post_notify: |
124 | for_each_online_cpu(cpu) { | 121 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
125 | freqs.cpu = cpu; | ||
126 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
127 | } | ||
128 | 122 | ||
129 | return ret; | 123 | return ret; |
130 | } | 124 | } |
diff --git a/drivers/cpufreq/cpufreq-nforce2.c b/drivers/cpufreq/cpufreq-nforce2.c index 13d311ee08b3..224a4787ecc2 100644 --- a/drivers/cpufreq/cpufreq-nforce2.c +++ b/drivers/cpufreq/cpufreq-nforce2.c | |||
@@ -263,7 +263,6 @@ static int nforce2_target(struct cpufreq_policy *policy, | |||
263 | 263 | ||
264 | freqs.old = nforce2_get(policy->cpu); | 264 | freqs.old = nforce2_get(policy->cpu); |
265 | freqs.new = target_fsb * fid * 100; | 265 | freqs.new = target_fsb * fid * 100; |
266 | freqs.cpu = 0; /* Only one CPU on nForce2 platforms */ | ||
267 | 266 | ||
268 | if (freqs.old == freqs.new) | 267 | if (freqs.old == freqs.new) |
269 | return 0; | 268 | return 0; |
@@ -271,7 +270,7 @@ static int nforce2_target(struct cpufreq_policy *policy, | |||
271 | pr_debug("Old CPU frequency %d kHz, new %d kHz\n", | 270 | pr_debug("Old CPU frequency %d kHz, new %d kHz\n", |
272 | freqs.old, freqs.new); | 271 | freqs.old, freqs.new); |
273 | 272 | ||
274 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 273 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
275 | 274 | ||
276 | /* Disable IRQs */ | 275 | /* Disable IRQs */ |
277 | /* local_irq_save(flags); */ | 276 | /* local_irq_save(flags); */ |
@@ -286,7 +285,7 @@ static int nforce2_target(struct cpufreq_policy *policy, | |||
286 | /* Enable IRQs */ | 285 | /* Enable IRQs */ |
287 | /* local_irq_restore(flags); */ | 286 | /* local_irq_restore(flags); */ |
288 | 287 | ||
289 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 288 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
290 | 289 | ||
291 | return 0; | 290 | return 0; |
292 | } | 291 | } |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 85963fc48a5f..0198cd0a60ce 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -249,19 +249,9 @@ static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) | |||
249 | #endif | 249 | #endif |
250 | 250 | ||
251 | 251 | ||
252 | /** | 252 | void __cpufreq_notify_transition(struct cpufreq_policy *policy, |
253 | * cpufreq_notify_transition - call notifier chain and adjust_jiffies | 253 | struct cpufreq_freqs *freqs, unsigned int state) |
254 | * on frequency transition. | ||
255 | * | ||
256 | * This function calls the transition notifiers and the "adjust_jiffies" | ||
257 | * function. It is called twice on all CPU frequency changes that have | ||
258 | * external effects. | ||
259 | */ | ||
260 | void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state) | ||
261 | { | 254 | { |
262 | struct cpufreq_policy *policy; | ||
263 | unsigned long flags; | ||
264 | |||
265 | BUG_ON(irqs_disabled()); | 255 | BUG_ON(irqs_disabled()); |
266 | 256 | ||
267 | if (cpufreq_disabled()) | 257 | if (cpufreq_disabled()) |
@@ -271,10 +261,6 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state) | |||
271 | pr_debug("notification %u of frequency transition to %u kHz\n", | 261 | pr_debug("notification %u of frequency transition to %u kHz\n", |
272 | state, freqs->new); | 262 | state, freqs->new); |
273 | 263 | ||
274 | read_lock_irqsave(&cpufreq_driver_lock, flags); | ||
275 | policy = per_cpu(cpufreq_cpu_data, freqs->cpu); | ||
276 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); | ||
277 | |||
278 | switch (state) { | 264 | switch (state) { |
279 | 265 | ||
280 | case CPUFREQ_PRECHANGE: | 266 | case CPUFREQ_PRECHANGE: |
@@ -308,6 +294,20 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state) | |||
308 | break; | 294 | break; |
309 | } | 295 | } |
310 | } | 296 | } |
297 | /** | ||
298 | * cpufreq_notify_transition - call notifier chain and adjust_jiffies | ||
299 | * on frequency transition. | ||
300 | * | ||
301 | * This function calls the transition notifiers and the "adjust_jiffies" | ||
302 | * function. It is called twice on all CPU frequency changes that have | ||
303 | * external effects. | ||
304 | */ | ||
305 | void cpufreq_notify_transition(struct cpufreq_policy *policy, | ||
306 | struct cpufreq_freqs *freqs, unsigned int state) | ||
307 | { | ||
308 | for_each_cpu(freqs->cpu, policy->cpus) | ||
309 | __cpufreq_notify_transition(policy, freqs, state); | ||
310 | } | ||
311 | EXPORT_SYMBOL_GPL(cpufreq_notify_transition); | 311 | EXPORT_SYMBOL_GPL(cpufreq_notify_transition); |
312 | 312 | ||
313 | 313 | ||
@@ -1141,16 +1141,23 @@ static void handle_update(struct work_struct *work) | |||
1141 | static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, | 1141 | static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, |
1142 | unsigned int new_freq) | 1142 | unsigned int new_freq) |
1143 | { | 1143 | { |
1144 | struct cpufreq_policy *policy; | ||
1144 | struct cpufreq_freqs freqs; | 1145 | struct cpufreq_freqs freqs; |
1146 | unsigned long flags; | ||
1147 | |||
1145 | 1148 | ||
1146 | pr_debug("Warning: CPU frequency out of sync: cpufreq and timing " | 1149 | pr_debug("Warning: CPU frequency out of sync: cpufreq and timing " |
1147 | "core thinks of %u, is %u kHz.\n", old_freq, new_freq); | 1150 | "core thinks of %u, is %u kHz.\n", old_freq, new_freq); |
1148 | 1151 | ||
1149 | freqs.cpu = cpu; | ||
1150 | freqs.old = old_freq; | 1152 | freqs.old = old_freq; |
1151 | freqs.new = new_freq; | 1153 | freqs.new = new_freq; |
1152 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 1154 | |
1153 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 1155 | read_lock_irqsave(&cpufreq_driver_lock, flags); |
1156 | policy = per_cpu(cpufreq_cpu_data, cpu); | ||
1157 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); | ||
1158 | |||
1159 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); | ||
1160 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); | ||
1154 | } | 1161 | } |
1155 | 1162 | ||
1156 | 1163 | ||
diff --git a/drivers/cpufreq/dbx500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c index 72f0c3efa76e..7192a6df94c0 100644 --- a/drivers/cpufreq/dbx500-cpufreq.c +++ b/drivers/cpufreq/dbx500-cpufreq.c | |||
@@ -55,8 +55,7 @@ static int dbx500_cpufreq_target(struct cpufreq_policy *policy, | |||
55 | return 0; | 55 | return 0; |
56 | 56 | ||
57 | /* pre-change notification */ | 57 | /* pre-change notification */ |
58 | for_each_cpu(freqs.cpu, policy->cpus) | 58 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
59 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
60 | 59 | ||
61 | /* update armss clk frequency */ | 60 | /* update armss clk frequency */ |
62 | ret = clk_set_rate(armss_clk, freqs.new * 1000); | 61 | ret = clk_set_rate(armss_clk, freqs.new * 1000); |
@@ -68,8 +67,7 @@ static int dbx500_cpufreq_target(struct cpufreq_policy *policy, | |||
68 | } | 67 | } |
69 | 68 | ||
70 | /* post change notification */ | 69 | /* post change notification */ |
71 | for_each_cpu(freqs.cpu, policy->cpus) | 70 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
72 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
73 | 71 | ||
74 | return 0; | 72 | return 0; |
75 | } | 73 | } |
diff --git a/drivers/cpufreq/e_powersaver.c b/drivers/cpufreq/e_powersaver.c index 3fffbe6025cd..37380fb92621 100644 --- a/drivers/cpufreq/e_powersaver.c +++ b/drivers/cpufreq/e_powersaver.c | |||
@@ -104,7 +104,7 @@ static unsigned int eps_get(unsigned int cpu) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | static int eps_set_state(struct eps_cpu_data *centaur, | 106 | static int eps_set_state(struct eps_cpu_data *centaur, |
107 | unsigned int cpu, | 107 | struct cpufreq_policy *policy, |
108 | u32 dest_state) | 108 | u32 dest_state) |
109 | { | 109 | { |
110 | struct cpufreq_freqs freqs; | 110 | struct cpufreq_freqs freqs; |
@@ -112,10 +112,9 @@ static int eps_set_state(struct eps_cpu_data *centaur, | |||
112 | int err = 0; | 112 | int err = 0; |
113 | int i; | 113 | int i; |
114 | 114 | ||
115 | freqs.old = eps_get(cpu); | 115 | freqs.old = eps_get(policy->cpu); |
116 | freqs.new = centaur->fsb * ((dest_state >> 8) & 0xff); | 116 | freqs.new = centaur->fsb * ((dest_state >> 8) & 0xff); |
117 | freqs.cpu = cpu; | 117 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
118 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
119 | 118 | ||
120 | /* Wait while CPU is busy */ | 119 | /* Wait while CPU is busy */ |
121 | rdmsr(MSR_IA32_PERF_STATUS, lo, hi); | 120 | rdmsr(MSR_IA32_PERF_STATUS, lo, hi); |
@@ -162,7 +161,7 @@ postchange: | |||
162 | current_multiplier); | 161 | current_multiplier); |
163 | } | 162 | } |
164 | #endif | 163 | #endif |
165 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 164 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
166 | return err; | 165 | return err; |
167 | } | 166 | } |
168 | 167 | ||
@@ -190,7 +189,7 @@ static int eps_target(struct cpufreq_policy *policy, | |||
190 | 189 | ||
191 | /* Make frequency transition */ | 190 | /* Make frequency transition */ |
192 | dest_state = centaur->freq_table[newstate].index & 0xffff; | 191 | dest_state = centaur->freq_table[newstate].index & 0xffff; |
193 | ret = eps_set_state(centaur, cpu, dest_state); | 192 | ret = eps_set_state(centaur, policy, dest_state); |
194 | if (ret) | 193 | if (ret) |
195 | printk(KERN_ERR "eps: Timeout!\n"); | 194 | printk(KERN_ERR "eps: Timeout!\n"); |
196 | return ret; | 195 | return ret; |
diff --git a/drivers/cpufreq/elanfreq.c b/drivers/cpufreq/elanfreq.c index 960671fd3d7e..658d860344b0 100644 --- a/drivers/cpufreq/elanfreq.c +++ b/drivers/cpufreq/elanfreq.c | |||
@@ -117,15 +117,15 @@ static unsigned int elanfreq_get_cpu_frequency(unsigned int cpu) | |||
117 | * There is no return value. | 117 | * There is no return value. |
118 | */ | 118 | */ |
119 | 119 | ||
120 | static void elanfreq_set_cpu_state(unsigned int state) | 120 | static void elanfreq_set_cpu_state(struct cpufreq_policy *policy, |
121 | unsigned int state) | ||
121 | { | 122 | { |
122 | struct cpufreq_freqs freqs; | 123 | struct cpufreq_freqs freqs; |
123 | 124 | ||
124 | freqs.old = elanfreq_get_cpu_frequency(0); | 125 | freqs.old = elanfreq_get_cpu_frequency(0); |
125 | freqs.new = elan_multiplier[state].clock; | 126 | freqs.new = elan_multiplier[state].clock; |
126 | freqs.cpu = 0; /* elanfreq.c is UP only driver */ | ||
127 | 127 | ||
128 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 128 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
129 | 129 | ||
130 | printk(KERN_INFO "elanfreq: attempting to set frequency to %i kHz\n", | 130 | printk(KERN_INFO "elanfreq: attempting to set frequency to %i kHz\n", |
131 | elan_multiplier[state].clock); | 131 | elan_multiplier[state].clock); |
@@ -161,7 +161,7 @@ static void elanfreq_set_cpu_state(unsigned int state) | |||
161 | udelay(10000); | 161 | udelay(10000); |
162 | local_irq_enable(); | 162 | local_irq_enable(); |
163 | 163 | ||
164 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 164 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
165 | }; | 165 | }; |
166 | 166 | ||
167 | 167 | ||
@@ -188,7 +188,7 @@ static int elanfreq_target(struct cpufreq_policy *policy, | |||
188 | target_freq, relation, &newstate)) | 188 | target_freq, relation, &newstate)) |
189 | return -EINVAL; | 189 | return -EINVAL; |
190 | 190 | ||
191 | elanfreq_set_cpu_state(newstate); | 191 | elanfreq_set_cpu_state(policy, newstate); |
192 | 192 | ||
193 | return 0; | 193 | return 0; |
194 | } | 194 | } |
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index 78057a357ddb..c0c4ce53b9e9 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c | |||
@@ -70,7 +70,6 @@ static int exynos_cpufreq_scale(unsigned int target_freq) | |||
70 | 70 | ||
71 | freqs.old = policy->cur; | 71 | freqs.old = policy->cur; |
72 | freqs.new = target_freq; | 72 | freqs.new = target_freq; |
73 | freqs.cpu = policy->cpu; | ||
74 | 73 | ||
75 | if (freqs.new == freqs.old) | 74 | if (freqs.new == freqs.old) |
76 | goto out; | 75 | goto out; |
@@ -105,8 +104,7 @@ static int exynos_cpufreq_scale(unsigned int target_freq) | |||
105 | } | 104 | } |
106 | arm_volt = volt_table[index]; | 105 | arm_volt = volt_table[index]; |
107 | 106 | ||
108 | for_each_cpu(freqs.cpu, policy->cpus) | 107 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
109 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
110 | 108 | ||
111 | /* When the new frequency is higher than current frequency */ | 109 | /* When the new frequency is higher than current frequency */ |
112 | if ((freqs.new > freqs.old) && !safe_arm_volt) { | 110 | if ((freqs.new > freqs.old) && !safe_arm_volt) { |
@@ -131,8 +129,7 @@ static int exynos_cpufreq_scale(unsigned int target_freq) | |||
131 | 129 | ||
132 | exynos_info->set_freq(old_index, index); | 130 | exynos_info->set_freq(old_index, index); |
133 | 131 | ||
134 | for_each_cpu(freqs.cpu, policy->cpus) | 132 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
135 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
136 | 133 | ||
137 | /* When the new frequency is lower than current frequency */ | 134 | /* When the new frequency is lower than current frequency */ |
138 | if ((freqs.new < freqs.old) || | 135 | if ((freqs.new < freqs.old) || |
diff --git a/drivers/cpufreq/gx-suspmod.c b/drivers/cpufreq/gx-suspmod.c index 456bee058fe6..3dfc99b9ca86 100644 --- a/drivers/cpufreq/gx-suspmod.c +++ b/drivers/cpufreq/gx-suspmod.c | |||
@@ -251,14 +251,13 @@ static unsigned int gx_validate_speed(unsigned int khz, u8 *on_duration, | |||
251 | * set cpu speed in khz. | 251 | * set cpu speed in khz. |
252 | **/ | 252 | **/ |
253 | 253 | ||
254 | static void gx_set_cpuspeed(unsigned int khz) | 254 | static void gx_set_cpuspeed(struct cpufreq_policy *policy, unsigned int khz) |
255 | { | 255 | { |
256 | u8 suscfg, pmer1; | 256 | u8 suscfg, pmer1; |
257 | unsigned int new_khz; | 257 | unsigned int new_khz; |
258 | unsigned long flags; | 258 | unsigned long flags; |
259 | struct cpufreq_freqs freqs; | 259 | struct cpufreq_freqs freqs; |
260 | 260 | ||
261 | freqs.cpu = 0; | ||
262 | freqs.old = gx_get_cpuspeed(0); | 261 | freqs.old = gx_get_cpuspeed(0); |
263 | 262 | ||
264 | new_khz = gx_validate_speed(khz, &gx_params->on_duration, | 263 | new_khz = gx_validate_speed(khz, &gx_params->on_duration, |
@@ -266,11 +265,9 @@ static void gx_set_cpuspeed(unsigned int khz) | |||
266 | 265 | ||
267 | freqs.new = new_khz; | 266 | freqs.new = new_khz; |
268 | 267 | ||
269 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 268 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
270 | local_irq_save(flags); | 269 | local_irq_save(flags); |
271 | 270 | ||
272 | |||
273 | |||
274 | if (new_khz != stock_freq) { | 271 | if (new_khz != stock_freq) { |
275 | /* if new khz == 100% of CPU speed, it is special case */ | 272 | /* if new khz == 100% of CPU speed, it is special case */ |
276 | switch (gx_params->cs55x0->device) { | 273 | switch (gx_params->cs55x0->device) { |
@@ -317,7 +314,7 @@ static void gx_set_cpuspeed(unsigned int khz) | |||
317 | 314 | ||
318 | gx_params->pci_suscfg = suscfg; | 315 | gx_params->pci_suscfg = suscfg; |
319 | 316 | ||
320 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 317 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
321 | 318 | ||
322 | pr_debug("suspend modulation w/ duration of ON:%d us, OFF:%d us\n", | 319 | pr_debug("suspend modulation w/ duration of ON:%d us, OFF:%d us\n", |
323 | gx_params->on_duration * 32, gx_params->off_duration * 32); | 320 | gx_params->on_duration * 32, gx_params->off_duration * 32); |
@@ -397,7 +394,7 @@ static int cpufreq_gx_target(struct cpufreq_policy *policy, | |||
397 | tmp_freq = gx_validate_speed(tmp_freq, &tmp1, &tmp2); | 394 | tmp_freq = gx_validate_speed(tmp_freq, &tmp1, &tmp2); |
398 | } | 395 | } |
399 | 396 | ||
400 | gx_set_cpuspeed(tmp_freq); | 397 | gx_set_cpuspeed(policy, tmp_freq); |
401 | 398 | ||
402 | return 0; | 399 | return 0; |
403 | } | 400 | } |
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 54e336de373b..b78bc35973ba 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c | |||
@@ -50,7 +50,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, | |||
50 | struct cpufreq_freqs freqs; | 50 | struct cpufreq_freqs freqs; |
51 | struct opp *opp; | 51 | struct opp *opp; |
52 | unsigned long freq_hz, volt, volt_old; | 52 | unsigned long freq_hz, volt, volt_old; |
53 | unsigned int index, cpu; | 53 | unsigned int index; |
54 | int ret; | 54 | int ret; |
55 | 55 | ||
56 | ret = cpufreq_frequency_table_target(policy, freq_table, target_freq, | 56 | ret = cpufreq_frequency_table_target(policy, freq_table, target_freq, |
@@ -68,10 +68,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, | |||
68 | if (freqs.old == freqs.new) | 68 | if (freqs.old == freqs.new) |
69 | return 0; | 69 | return 0; |
70 | 70 | ||
71 | for_each_online_cpu(cpu) { | 71 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
72 | freqs.cpu = cpu; | ||
73 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
74 | } | ||
75 | 72 | ||
76 | rcu_read_lock(); | 73 | rcu_read_lock(); |
77 | opp = opp_find_freq_ceil(cpu_dev, &freq_hz); | 74 | opp = opp_find_freq_ceil(cpu_dev, &freq_hz); |
@@ -166,10 +163,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, | |||
166 | } | 163 | } |
167 | } | 164 | } |
168 | 165 | ||
169 | for_each_online_cpu(cpu) { | 166 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
170 | freqs.cpu = cpu; | ||
171 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
172 | } | ||
173 | 167 | ||
174 | return 0; | 168 | return 0; |
175 | } | 169 | } |
diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c index 60524764fe4e..d36ea8dc96eb 100644 --- a/drivers/cpufreq/kirkwood-cpufreq.c +++ b/drivers/cpufreq/kirkwood-cpufreq.c | |||
@@ -55,7 +55,8 @@ static unsigned int kirkwood_cpufreq_get_cpu_frequency(unsigned int cpu) | |||
55 | return kirkwood_freq_table[0].frequency; | 55 | return kirkwood_freq_table[0].frequency; |
56 | } | 56 | } |
57 | 57 | ||
58 | static void kirkwood_cpufreq_set_cpu_state(unsigned int index) | 58 | static void kirkwood_cpufreq_set_cpu_state(struct cpufreq_policy *policy, |
59 | unsigned int index) | ||
59 | { | 60 | { |
60 | struct cpufreq_freqs freqs; | 61 | struct cpufreq_freqs freqs; |
61 | unsigned int state = kirkwood_freq_table[index].index; | 62 | unsigned int state = kirkwood_freq_table[index].index; |
@@ -63,9 +64,8 @@ static void kirkwood_cpufreq_set_cpu_state(unsigned int index) | |||
63 | 64 | ||
64 | freqs.old = kirkwood_cpufreq_get_cpu_frequency(0); | 65 | freqs.old = kirkwood_cpufreq_get_cpu_frequency(0); |
65 | freqs.new = kirkwood_freq_table[index].frequency; | 66 | freqs.new = kirkwood_freq_table[index].frequency; |
66 | freqs.cpu = 0; /* Kirkwood is UP */ | ||
67 | 67 | ||
68 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 68 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
69 | 69 | ||
70 | dev_dbg(priv.dev, "Attempting to set frequency to %i KHz\n", | 70 | dev_dbg(priv.dev, "Attempting to set frequency to %i KHz\n", |
71 | kirkwood_freq_table[index].frequency); | 71 | kirkwood_freq_table[index].frequency); |
@@ -99,7 +99,7 @@ static void kirkwood_cpufreq_set_cpu_state(unsigned int index) | |||
99 | 99 | ||
100 | local_irq_enable(); | 100 | local_irq_enable(); |
101 | } | 101 | } |
102 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 102 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
103 | }; | 103 | }; |
104 | 104 | ||
105 | static int kirkwood_cpufreq_verify(struct cpufreq_policy *policy) | 105 | static int kirkwood_cpufreq_verify(struct cpufreq_policy *policy) |
@@ -117,7 +117,7 @@ static int kirkwood_cpufreq_target(struct cpufreq_policy *policy, | |||
117 | target_freq, relation, &index)) | 117 | target_freq, relation, &index)) |
118 | return -EINVAL; | 118 | return -EINVAL; |
119 | 119 | ||
120 | kirkwood_cpufreq_set_cpu_state(index); | 120 | kirkwood_cpufreq_set_cpu_state(policy, index); |
121 | 121 | ||
122 | return 0; | 122 | return 0; |
123 | } | 123 | } |
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index 1180d536d1eb..b448638e34de 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c | |||
@@ -242,7 +242,8 @@ static void do_powersaver(int cx_address, unsigned int mults_index, | |||
242 | * Sets a new clock ratio. | 242 | * Sets a new clock ratio. |
243 | */ | 243 | */ |
244 | 244 | ||
245 | static void longhaul_setstate(unsigned int table_index) | 245 | static void longhaul_setstate(struct cpufreq_policy *policy, |
246 | unsigned int table_index) | ||
246 | { | 247 | { |
247 | unsigned int mults_index; | 248 | unsigned int mults_index; |
248 | int speed, mult; | 249 | int speed, mult; |
@@ -267,9 +268,8 @@ static void longhaul_setstate(unsigned int table_index) | |||
267 | 268 | ||
268 | freqs.old = calc_speed(longhaul_get_cpu_mult()); | 269 | freqs.old = calc_speed(longhaul_get_cpu_mult()); |
269 | freqs.new = speed; | 270 | freqs.new = speed; |
270 | freqs.cpu = 0; /* longhaul.c is UP only driver */ | ||
271 | 271 | ||
272 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 272 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
273 | 273 | ||
274 | pr_debug("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n", | 274 | pr_debug("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n", |
275 | fsb, mult/10, mult%10, print_speed(speed/1000)); | 275 | fsb, mult/10, mult%10, print_speed(speed/1000)); |
@@ -386,7 +386,7 @@ retry_loop: | |||
386 | } | 386 | } |
387 | } | 387 | } |
388 | /* Report true CPU frequency */ | 388 | /* Report true CPU frequency */ |
389 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 389 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
390 | 390 | ||
391 | if (!bm_timeout) | 391 | if (!bm_timeout) |
392 | printk(KERN_INFO PFX "Warning: Timeout while waiting for " | 392 | printk(KERN_INFO PFX "Warning: Timeout while waiting for " |
@@ -648,7 +648,7 @@ static int longhaul_target(struct cpufreq_policy *policy, | |||
648 | return 0; | 648 | return 0; |
649 | 649 | ||
650 | if (!can_scale_voltage) | 650 | if (!can_scale_voltage) |
651 | longhaul_setstate(table_index); | 651 | longhaul_setstate(policy, table_index); |
652 | else { | 652 | else { |
653 | /* On test system voltage transitions exceeding single | 653 | /* On test system voltage transitions exceeding single |
654 | * step up or down were turning motherboard off. Both | 654 | * step up or down were turning motherboard off. Both |
@@ -663,7 +663,7 @@ static int longhaul_target(struct cpufreq_policy *policy, | |||
663 | while (i != table_index) { | 663 | while (i != table_index) { |
664 | vid = (longhaul_table[i].index >> 8) & 0x1f; | 664 | vid = (longhaul_table[i].index >> 8) & 0x1f; |
665 | if (vid != current_vid) { | 665 | if (vid != current_vid) { |
666 | longhaul_setstate(i); | 666 | longhaul_setstate(policy, i); |
667 | current_vid = vid; | 667 | current_vid = vid; |
668 | msleep(200); | 668 | msleep(200); |
669 | } | 669 | } |
@@ -672,7 +672,7 @@ static int longhaul_target(struct cpufreq_policy *policy, | |||
672 | else | 672 | else |
673 | i--; | 673 | i--; |
674 | } | 674 | } |
675 | longhaul_setstate(table_index); | 675 | longhaul_setstate(policy, table_index); |
676 | } | 676 | } |
677 | longhaul_index = table_index; | 677 | longhaul_index = table_index; |
678 | return 0; | 678 | return 0; |
@@ -998,15 +998,17 @@ static int __init longhaul_init(void) | |||
998 | 998 | ||
999 | static void __exit longhaul_exit(void) | 999 | static void __exit longhaul_exit(void) |
1000 | { | 1000 | { |
1001 | struct cpufreq_policy *policy = cpufreq_cpu_get(0); | ||
1001 | int i; | 1002 | int i; |
1002 | 1003 | ||
1003 | for (i = 0; i < numscales; i++) { | 1004 | for (i = 0; i < numscales; i++) { |
1004 | if (mults[i] == maxmult) { | 1005 | if (mults[i] == maxmult) { |
1005 | longhaul_setstate(i); | 1006 | longhaul_setstate(policy, i); |
1006 | break; | 1007 | break; |
1007 | } | 1008 | } |
1008 | } | 1009 | } |
1009 | 1010 | ||
1011 | cpufreq_cpu_put(policy); | ||
1010 | cpufreq_unregister_driver(&longhaul_driver); | 1012 | cpufreq_unregister_driver(&longhaul_driver); |
1011 | kfree(longhaul_table); | 1013 | kfree(longhaul_table); |
1012 | } | 1014 | } |
diff --git a/drivers/cpufreq/maple-cpufreq.c b/drivers/cpufreq/maple-cpufreq.c index d4c4989823dc..cdd62915efaf 100644 --- a/drivers/cpufreq/maple-cpufreq.c +++ b/drivers/cpufreq/maple-cpufreq.c | |||
@@ -158,11 +158,10 @@ static int maple_cpufreq_target(struct cpufreq_policy *policy, | |||
158 | 158 | ||
159 | freqs.old = maple_cpu_freqs[maple_pmode_cur].frequency; | 159 | freqs.old = maple_cpu_freqs[maple_pmode_cur].frequency; |
160 | freqs.new = maple_cpu_freqs[newstate].frequency; | 160 | freqs.new = maple_cpu_freqs[newstate].frequency; |
161 | freqs.cpu = 0; | ||
162 | 161 | ||
163 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 162 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
164 | rc = maple_scom_switch_freq(newstate); | 163 | rc = maple_scom_switch_freq(newstate); |
165 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 164 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
166 | 165 | ||
167 | mutex_unlock(&maple_switch_mutex); | 166 | mutex_unlock(&maple_switch_mutex); |
168 | 167 | ||
diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c index 9128c07bafba..b610edd820b1 100644 --- a/drivers/cpufreq/omap-cpufreq.c +++ b/drivers/cpufreq/omap-cpufreq.c | |||
@@ -88,16 +88,12 @@ static int omap_target(struct cpufreq_policy *policy, | |||
88 | } | 88 | } |
89 | 89 | ||
90 | freqs.old = omap_getspeed(policy->cpu); | 90 | freqs.old = omap_getspeed(policy->cpu); |
91 | freqs.cpu = policy->cpu; | ||
92 | 91 | ||
93 | if (freqs.old == freqs.new && policy->cur == freqs.new) | 92 | if (freqs.old == freqs.new && policy->cur == freqs.new) |
94 | return ret; | 93 | return ret; |
95 | 94 | ||
96 | /* notifiers */ | 95 | /* notifiers */ |
97 | for_each_cpu(i, policy->cpus) { | 96 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
98 | freqs.cpu = i; | ||
99 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
100 | } | ||
101 | 97 | ||
102 | freq = freqs.new * 1000; | 98 | freq = freqs.new * 1000; |
103 | ret = clk_round_rate(mpu_clk, freq); | 99 | ret = clk_round_rate(mpu_clk, freq); |
@@ -157,10 +153,7 @@ static int omap_target(struct cpufreq_policy *policy, | |||
157 | 153 | ||
158 | done: | 154 | done: |
159 | /* notifiers */ | 155 | /* notifiers */ |
160 | for_each_cpu(i, policy->cpus) { | 156 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
161 | freqs.cpu = i; | ||
162 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
163 | } | ||
164 | 157 | ||
165 | return ret; | 158 | return ret; |
166 | } | 159 | } |
diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c index 827629c9aad7..4b2e7737b939 100644 --- a/drivers/cpufreq/p4-clockmod.c +++ b/drivers/cpufreq/p4-clockmod.c | |||
@@ -125,10 +125,7 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy, | |||
125 | return 0; | 125 | return 0; |
126 | 126 | ||
127 | /* notifiers */ | 127 | /* notifiers */ |
128 | for_each_cpu(i, policy->cpus) { | 128 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
129 | freqs.cpu = i; | ||
130 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
131 | } | ||
132 | 129 | ||
133 | /* run on each logical CPU, | 130 | /* run on each logical CPU, |
134 | * see section 13.15.3 of IA32 Intel Architecture Software | 131 | * see section 13.15.3 of IA32 Intel Architecture Software |
@@ -138,10 +135,7 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy, | |||
138 | cpufreq_p4_setdc(i, p4clockmod_table[newstate].index); | 135 | cpufreq_p4_setdc(i, p4clockmod_table[newstate].index); |
139 | 136 | ||
140 | /* notifiers */ | 137 | /* notifiers */ |
141 | for_each_cpu(i, policy->cpus) { | 138 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
142 | freqs.cpu = i; | ||
143 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
144 | } | ||
145 | 139 | ||
146 | return 0; | 140 | return 0; |
147 | } | 141 | } |
diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c index 503996a94a6a..0de00081a81e 100644 --- a/drivers/cpufreq/pcc-cpufreq.c +++ b/drivers/cpufreq/pcc-cpufreq.c | |||
@@ -215,8 +215,7 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy, | |||
215 | (pcch_virt_addr + pcc_cpu_data->input_offset)); | 215 | (pcch_virt_addr + pcc_cpu_data->input_offset)); |
216 | 216 | ||
217 | freqs.new = target_freq; | 217 | freqs.new = target_freq; |
218 | freqs.cpu = cpu; | 218 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
219 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
220 | 219 | ||
221 | input_buffer = 0x1 | (((target_freq * 100) | 220 | input_buffer = 0x1 | (((target_freq * 100) |
222 | / (ioread32(&pcch_hdr->nominal) * 1000)) << 8); | 221 | / (ioread32(&pcch_hdr->nominal) * 1000)) << 8); |
@@ -237,7 +236,7 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy, | |||
237 | } | 236 | } |
238 | iowrite16(0, &pcch_hdr->status); | 237 | iowrite16(0, &pcch_hdr->status); |
239 | 238 | ||
240 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 239 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
241 | pr_debug("target: was SUCCESSFUL for cpu %d\n", cpu); | 240 | pr_debug("target: was SUCCESSFUL for cpu %d\n", cpu); |
242 | spin_unlock(&pcc_lock); | 241 | spin_unlock(&pcc_lock); |
243 | 242 | ||
diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c index af23e0b9ec92..ea0222a45b7b 100644 --- a/drivers/cpufreq/powernow-k6.c +++ b/drivers/cpufreq/powernow-k6.c | |||
@@ -68,7 +68,8 @@ static int powernow_k6_get_cpu_multiplier(void) | |||
68 | * | 68 | * |
69 | * Tries to change the PowerNow! multiplier | 69 | * Tries to change the PowerNow! multiplier |
70 | */ | 70 | */ |
71 | static void powernow_k6_set_state(unsigned int best_i) | 71 | static void powernow_k6_set_state(struct cpufreq_policy *policy, |
72 | unsigned int best_i) | ||
72 | { | 73 | { |
73 | unsigned long outvalue = 0, invalue = 0; | 74 | unsigned long outvalue = 0, invalue = 0; |
74 | unsigned long msrval; | 75 | unsigned long msrval; |
@@ -81,9 +82,8 @@ static void powernow_k6_set_state(unsigned int best_i) | |||
81 | 82 | ||
82 | freqs.old = busfreq * powernow_k6_get_cpu_multiplier(); | 83 | freqs.old = busfreq * powernow_k6_get_cpu_multiplier(); |
83 | freqs.new = busfreq * clock_ratio[best_i].index; | 84 | freqs.new = busfreq * clock_ratio[best_i].index; |
84 | freqs.cpu = 0; /* powernow-k6.c is UP only driver */ | ||
85 | 85 | ||
86 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 86 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
87 | 87 | ||
88 | /* we now need to transform best_i to the BVC format, see AMD#23446 */ | 88 | /* we now need to transform best_i to the BVC format, see AMD#23446 */ |
89 | 89 | ||
@@ -98,7 +98,7 @@ static void powernow_k6_set_state(unsigned int best_i) | |||
98 | msrval = POWERNOW_IOPORT + 0x0; | 98 | msrval = POWERNOW_IOPORT + 0x0; |
99 | wrmsr(MSR_K6_EPMR, msrval, 0); /* disable it again */ | 99 | wrmsr(MSR_K6_EPMR, msrval, 0); /* disable it again */ |
100 | 100 | ||
101 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 101 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
102 | 102 | ||
103 | return; | 103 | return; |
104 | } | 104 | } |
@@ -136,7 +136,7 @@ static int powernow_k6_target(struct cpufreq_policy *policy, | |||
136 | target_freq, relation, &newstate)) | 136 | target_freq, relation, &newstate)) |
137 | return -EINVAL; | 137 | return -EINVAL; |
138 | 138 | ||
139 | powernow_k6_set_state(newstate); | 139 | powernow_k6_set_state(policy, newstate); |
140 | 140 | ||
141 | return 0; | 141 | return 0; |
142 | } | 142 | } |
@@ -182,7 +182,7 @@ static int powernow_k6_cpu_exit(struct cpufreq_policy *policy) | |||
182 | unsigned int i; | 182 | unsigned int i; |
183 | for (i = 0; i < 8; i++) { | 183 | for (i = 0; i < 8; i++) { |
184 | if (i == max_multiplier) | 184 | if (i == max_multiplier) |
185 | powernow_k6_set_state(i); | 185 | powernow_k6_set_state(policy, i); |
186 | } | 186 | } |
187 | cpufreq_frequency_table_put_attr(policy->cpu); | 187 | cpufreq_frequency_table_put_attr(policy->cpu); |
188 | return 0; | 188 | return 0; |
diff --git a/drivers/cpufreq/powernow-k7.c b/drivers/cpufreq/powernow-k7.c index 334cc2f1e9f1..53888dacbe58 100644 --- a/drivers/cpufreq/powernow-k7.c +++ b/drivers/cpufreq/powernow-k7.c | |||
@@ -248,7 +248,7 @@ static void change_VID(int vid) | |||
248 | } | 248 | } |
249 | 249 | ||
250 | 250 | ||
251 | static void change_speed(unsigned int index) | 251 | static void change_speed(struct cpufreq_policy *policy, unsigned int index) |
252 | { | 252 | { |
253 | u8 fid, vid; | 253 | u8 fid, vid; |
254 | struct cpufreq_freqs freqs; | 254 | struct cpufreq_freqs freqs; |
@@ -263,15 +263,13 @@ static void change_speed(unsigned int index) | |||
263 | fid = powernow_table[index].index & 0xFF; | 263 | fid = powernow_table[index].index & 0xFF; |
264 | vid = (powernow_table[index].index & 0xFF00) >> 8; | 264 | vid = (powernow_table[index].index & 0xFF00) >> 8; |
265 | 265 | ||
266 | freqs.cpu = 0; | ||
267 | |||
268 | rdmsrl(MSR_K7_FID_VID_STATUS, fidvidstatus.val); | 266 | rdmsrl(MSR_K7_FID_VID_STATUS, fidvidstatus.val); |
269 | cfid = fidvidstatus.bits.CFID; | 267 | cfid = fidvidstatus.bits.CFID; |
270 | freqs.old = fsb * fid_codes[cfid] / 10; | 268 | freqs.old = fsb * fid_codes[cfid] / 10; |
271 | 269 | ||
272 | freqs.new = powernow_table[index].frequency; | 270 | freqs.new = powernow_table[index].frequency; |
273 | 271 | ||
274 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 272 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
275 | 273 | ||
276 | /* Now do the magic poking into the MSRs. */ | 274 | /* Now do the magic poking into the MSRs. */ |
277 | 275 | ||
@@ -292,7 +290,7 @@ static void change_speed(unsigned int index) | |||
292 | if (have_a0 == 1) | 290 | if (have_a0 == 1) |
293 | local_irq_enable(); | 291 | local_irq_enable(); |
294 | 292 | ||
295 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 293 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
296 | } | 294 | } |
297 | 295 | ||
298 | 296 | ||
@@ -546,7 +544,7 @@ static int powernow_target(struct cpufreq_policy *policy, | |||
546 | relation, &newstate)) | 544 | relation, &newstate)) |
547 | return -EINVAL; | 545 | return -EINVAL; |
548 | 546 | ||
549 | change_speed(newstate); | 547 | change_speed(policy, newstate); |
550 | 548 | ||
551 | return 0; | 549 | return 0; |
552 | } | 550 | } |
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index d13a13678b5f..52137a323965 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c | |||
@@ -928,9 +928,10 @@ static int get_transition_latency(struct powernow_k8_data *data) | |||
928 | static int transition_frequency_fidvid(struct powernow_k8_data *data, | 928 | static int transition_frequency_fidvid(struct powernow_k8_data *data, |
929 | unsigned int index) | 929 | unsigned int index) |
930 | { | 930 | { |
931 | struct cpufreq_policy *policy; | ||
931 | u32 fid = 0; | 932 | u32 fid = 0; |
932 | u32 vid = 0; | 933 | u32 vid = 0; |
933 | int res, i; | 934 | int res; |
934 | struct cpufreq_freqs freqs; | 935 | struct cpufreq_freqs freqs; |
935 | 936 | ||
936 | pr_debug("cpu %d transition to index %u\n", smp_processor_id(), index); | 937 | pr_debug("cpu %d transition to index %u\n", smp_processor_id(), index); |
@@ -959,10 +960,10 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, | |||
959 | freqs.old = find_khz_freq_from_fid(data->currfid); | 960 | freqs.old = find_khz_freq_from_fid(data->currfid); |
960 | freqs.new = find_khz_freq_from_fid(fid); | 961 | freqs.new = find_khz_freq_from_fid(fid); |
961 | 962 | ||
962 | for_each_cpu(i, data->available_cores) { | 963 | policy = cpufreq_cpu_get(smp_processor_id()); |
963 | freqs.cpu = i; | 964 | cpufreq_cpu_put(policy); |
964 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 965 | |
965 | } | 966 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
966 | 967 | ||
967 | res = transition_fid_vid(data, fid, vid); | 968 | res = transition_fid_vid(data, fid, vid); |
968 | if (res) | 969 | if (res) |
@@ -970,10 +971,7 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, | |||
970 | 971 | ||
971 | freqs.new = find_khz_freq_from_fid(data->currfid); | 972 | freqs.new = find_khz_freq_from_fid(data->currfid); |
972 | 973 | ||
973 | for_each_cpu(i, data->available_cores) { | 974 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
974 | freqs.cpu = i; | ||
975 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
976 | } | ||
977 | return res; | 975 | return res; |
978 | } | 976 | } |
979 | 977 | ||
diff --git a/drivers/cpufreq/s3c2416-cpufreq.c b/drivers/cpufreq/s3c2416-cpufreq.c index bcc053bc02c4..4f1881eee3f1 100644 --- a/drivers/cpufreq/s3c2416-cpufreq.c +++ b/drivers/cpufreq/s3c2416-cpufreq.c | |||
@@ -256,7 +256,6 @@ static int s3c2416_cpufreq_set_target(struct cpufreq_policy *policy, | |||
256 | goto out; | 256 | goto out; |
257 | } | 257 | } |
258 | 258 | ||
259 | freqs.cpu = 0; | ||
260 | freqs.flags = 0; | 259 | freqs.flags = 0; |
261 | freqs.old = s3c_freq->is_dvs ? FREQ_DVS | 260 | freqs.old = s3c_freq->is_dvs ? FREQ_DVS |
262 | : clk_get_rate(s3c_freq->armclk) / 1000; | 261 | : clk_get_rate(s3c_freq->armclk) / 1000; |
@@ -274,7 +273,7 @@ static int s3c2416_cpufreq_set_target(struct cpufreq_policy *policy, | |||
274 | if (!to_dvs && freqs.old == freqs.new) | 273 | if (!to_dvs && freqs.old == freqs.new) |
275 | goto out; | 274 | goto out; |
276 | 275 | ||
277 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 276 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
278 | 277 | ||
279 | if (to_dvs) { | 278 | if (to_dvs) { |
280 | pr_debug("cpufreq: enter dvs\n"); | 279 | pr_debug("cpufreq: enter dvs\n"); |
@@ -287,7 +286,7 @@ static int s3c2416_cpufreq_set_target(struct cpufreq_policy *policy, | |||
287 | ret = s3c2416_cpufreq_set_armdiv(s3c_freq, freqs.new); | 286 | ret = s3c2416_cpufreq_set_armdiv(s3c_freq, freqs.new); |
288 | } | 287 | } |
289 | 288 | ||
290 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 289 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
291 | 290 | ||
292 | out: | 291 | out: |
293 | mutex_unlock(&cpufreq_lock); | 292 | mutex_unlock(&cpufreq_lock); |
diff --git a/drivers/cpufreq/s3c64xx-cpufreq.c b/drivers/cpufreq/s3c64xx-cpufreq.c index 6f9490b3c356..27cacb524796 100644 --- a/drivers/cpufreq/s3c64xx-cpufreq.c +++ b/drivers/cpufreq/s3c64xx-cpufreq.c | |||
@@ -84,7 +84,6 @@ static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy, | |||
84 | if (ret != 0) | 84 | if (ret != 0) |
85 | return ret; | 85 | return ret; |
86 | 86 | ||
87 | freqs.cpu = 0; | ||
88 | freqs.old = clk_get_rate(armclk) / 1000; | 87 | freqs.old = clk_get_rate(armclk) / 1000; |
89 | freqs.new = s3c64xx_freq_table[i].frequency; | 88 | freqs.new = s3c64xx_freq_table[i].frequency; |
90 | freqs.flags = 0; | 89 | freqs.flags = 0; |
@@ -95,7 +94,7 @@ static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy, | |||
95 | 94 | ||
96 | pr_debug("Transition %d-%dkHz\n", freqs.old, freqs.new); | 95 | pr_debug("Transition %d-%dkHz\n", freqs.old, freqs.new); |
97 | 96 | ||
98 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 97 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
99 | 98 | ||
100 | #ifdef CONFIG_REGULATOR | 99 | #ifdef CONFIG_REGULATOR |
101 | if (vddarm && freqs.new > freqs.old) { | 100 | if (vddarm && freqs.new > freqs.old) { |
@@ -117,7 +116,7 @@ static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy, | |||
117 | goto err; | 116 | goto err; |
118 | } | 117 | } |
119 | 118 | ||
120 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 119 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
121 | 120 | ||
122 | #ifdef CONFIG_REGULATOR | 121 | #ifdef CONFIG_REGULATOR |
123 | if (vddarm && freqs.new < freqs.old) { | 122 | if (vddarm && freqs.new < freqs.old) { |
@@ -141,7 +140,7 @@ err_clk: | |||
141 | if (clk_set_rate(armclk, freqs.old * 1000) < 0) | 140 | if (clk_set_rate(armclk, freqs.old * 1000) < 0) |
142 | pr_err("Failed to restore original clock rate\n"); | 141 | pr_err("Failed to restore original clock rate\n"); |
143 | err: | 142 | err: |
144 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 143 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
145 | 144 | ||
146 | return ret; | 145 | return ret; |
147 | } | 146 | } |
diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c index a484aaea9809..5c7757073793 100644 --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c | |||
@@ -229,7 +229,6 @@ static int s5pv210_target(struct cpufreq_policy *policy, | |||
229 | } | 229 | } |
230 | 230 | ||
231 | freqs.new = s5pv210_freq_table[index].frequency; | 231 | freqs.new = s5pv210_freq_table[index].frequency; |
232 | freqs.cpu = 0; | ||
233 | 232 | ||
234 | if (freqs.new == freqs.old) | 233 | if (freqs.new == freqs.old) |
235 | goto exit; | 234 | goto exit; |
@@ -256,7 +255,7 @@ static int s5pv210_target(struct cpufreq_policy *policy, | |||
256 | goto exit; | 255 | goto exit; |
257 | } | 256 | } |
258 | 257 | ||
259 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 258 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
260 | 259 | ||
261 | /* Check if there need to change PLL */ | 260 | /* Check if there need to change PLL */ |
262 | if ((index == L0) || (priv_index == L0)) | 261 | if ((index == L0) || (priv_index == L0)) |
@@ -468,7 +467,7 @@ static int s5pv210_target(struct cpufreq_policy *policy, | |||
468 | } | 467 | } |
469 | } | 468 | } |
470 | 469 | ||
471 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 470 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
472 | 471 | ||
473 | if (freqs.new < freqs.old) { | 472 | if (freqs.new < freqs.old) { |
474 | regulator_set_voltage(int_regulator, | 473 | regulator_set_voltage(int_regulator, |
diff --git a/drivers/cpufreq/sc520_freq.c b/drivers/cpufreq/sc520_freq.c index e42e073cd9b8..f740b134d27b 100644 --- a/drivers/cpufreq/sc520_freq.c +++ b/drivers/cpufreq/sc520_freq.c | |||
@@ -53,7 +53,8 @@ static unsigned int sc520_freq_get_cpu_frequency(unsigned int cpu) | |||
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | static void sc520_freq_set_cpu_state(unsigned int state) | 56 | static void sc520_freq_set_cpu_state(struct cpufreq_policy *policy, |
57 | unsigned int state) | ||
57 | { | 58 | { |
58 | 59 | ||
59 | struct cpufreq_freqs freqs; | 60 | struct cpufreq_freqs freqs; |
@@ -61,9 +62,8 @@ static void sc520_freq_set_cpu_state(unsigned int state) | |||
61 | 62 | ||
62 | freqs.old = sc520_freq_get_cpu_frequency(0); | 63 | freqs.old = sc520_freq_get_cpu_frequency(0); |
63 | freqs.new = sc520_freq_table[state].frequency; | 64 | freqs.new = sc520_freq_table[state].frequency; |
64 | freqs.cpu = 0; /* AMD Elan is UP */ | ||
65 | 65 | ||
66 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 66 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
67 | 67 | ||
68 | pr_debug("attempting to set frequency to %i kHz\n", | 68 | pr_debug("attempting to set frequency to %i kHz\n", |
69 | sc520_freq_table[state].frequency); | 69 | sc520_freq_table[state].frequency); |
@@ -75,7 +75,7 @@ static void sc520_freq_set_cpu_state(unsigned int state) | |||
75 | 75 | ||
76 | local_irq_enable(); | 76 | local_irq_enable(); |
77 | 77 | ||
78 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 78 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
79 | }; | 79 | }; |
80 | 80 | ||
81 | static int sc520_freq_verify(struct cpufreq_policy *policy) | 81 | static int sc520_freq_verify(struct cpufreq_policy *policy) |
@@ -93,7 +93,7 @@ static int sc520_freq_target(struct cpufreq_policy *policy, | |||
93 | target_freq, relation, &newstate)) | 93 | target_freq, relation, &newstate)) |
94 | return -EINVAL; | 94 | return -EINVAL; |
95 | 95 | ||
96 | sc520_freq_set_cpu_state(newstate); | 96 | sc520_freq_set_cpu_state(policy, newstate); |
97 | 97 | ||
98 | return 0; | 98 | return 0; |
99 | } | 99 | } |
diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c index 7e4d77327957..156829f4576d 100644 --- a/drivers/cpufreq/spear-cpufreq.c +++ b/drivers/cpufreq/spear-cpufreq.c | |||
@@ -121,7 +121,6 @@ static int spear_cpufreq_target(struct cpufreq_policy *policy, | |||
121 | target_freq, relation, &index)) | 121 | target_freq, relation, &index)) |
122 | return -EINVAL; | 122 | return -EINVAL; |
123 | 123 | ||
124 | freqs.cpu = policy->cpu; | ||
125 | freqs.old = spear_cpufreq_get(0); | 124 | freqs.old = spear_cpufreq_get(0); |
126 | 125 | ||
127 | newfreq = spear_cpufreq.freq_tbl[index].frequency * 1000; | 126 | newfreq = spear_cpufreq.freq_tbl[index].frequency * 1000; |
@@ -158,8 +157,7 @@ static int spear_cpufreq_target(struct cpufreq_policy *policy, | |||
158 | freqs.new = newfreq / 1000; | 157 | freqs.new = newfreq / 1000; |
159 | freqs.new /= mult; | 158 | freqs.new /= mult; |
160 | 159 | ||
161 | for_each_cpu(freqs.cpu, policy->cpus) | 160 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
162 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
163 | 161 | ||
164 | if (mult == 2) | 162 | if (mult == 2) |
165 | ret = spear1340_set_cpu_rate(srcclk, newfreq); | 163 | ret = spear1340_set_cpu_rate(srcclk, newfreq); |
@@ -172,8 +170,7 @@ static int spear_cpufreq_target(struct cpufreq_policy *policy, | |||
172 | freqs.new = clk_get_rate(spear_cpufreq.clk) / 1000; | 170 | freqs.new = clk_get_rate(spear_cpufreq.clk) / 1000; |
173 | } | 171 | } |
174 | 172 | ||
175 | for_each_cpu(freqs.cpu, policy->cpus) | 173 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
176 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
177 | return ret; | 174 | return ret; |
178 | } | 175 | } |
179 | 176 | ||
diff --git a/drivers/cpufreq/speedstep-centrino.c b/drivers/cpufreq/speedstep-centrino.c index 3a953d519f46..3dbbcc3519af 100644 --- a/drivers/cpufreq/speedstep-centrino.c +++ b/drivers/cpufreq/speedstep-centrino.c | |||
@@ -457,7 +457,7 @@ static int centrino_target (struct cpufreq_policy *policy, | |||
457 | unsigned int msr, oldmsr = 0, h = 0, cpu = policy->cpu; | 457 | unsigned int msr, oldmsr = 0, h = 0, cpu = policy->cpu; |
458 | struct cpufreq_freqs freqs; | 458 | struct cpufreq_freqs freqs; |
459 | int retval = 0; | 459 | int retval = 0; |
460 | unsigned int j, k, first_cpu, tmp; | 460 | unsigned int j, first_cpu, tmp; |
461 | cpumask_var_t covered_cpus; | 461 | cpumask_var_t covered_cpus; |
462 | 462 | ||
463 | if (unlikely(!zalloc_cpumask_var(&covered_cpus, GFP_KERNEL))) | 463 | if (unlikely(!zalloc_cpumask_var(&covered_cpus, GFP_KERNEL))) |
@@ -522,13 +522,8 @@ static int centrino_target (struct cpufreq_policy *policy, | |||
522 | pr_debug("target=%dkHz old=%d new=%d msr=%04x\n", | 522 | pr_debug("target=%dkHz old=%d new=%d msr=%04x\n", |
523 | target_freq, freqs.old, freqs.new, msr); | 523 | target_freq, freqs.old, freqs.new, msr); |
524 | 524 | ||
525 | for_each_cpu(k, policy->cpus) { | 525 | cpufreq_notify_transition(policy, &freqs, |
526 | if (!cpu_online(k)) | ||
527 | continue; | ||
528 | freqs.cpu = k; | ||
529 | cpufreq_notify_transition(&freqs, | ||
530 | CPUFREQ_PRECHANGE); | 526 | CPUFREQ_PRECHANGE); |
531 | } | ||
532 | 527 | ||
533 | first_cpu = 0; | 528 | first_cpu = 0; |
534 | /* all but 16 LSB are reserved, treat them with care */ | 529 | /* all but 16 LSB are reserved, treat them with care */ |
@@ -544,12 +539,7 @@ static int centrino_target (struct cpufreq_policy *policy, | |||
544 | cpumask_set_cpu(j, covered_cpus); | 539 | cpumask_set_cpu(j, covered_cpus); |
545 | } | 540 | } |
546 | 541 | ||
547 | for_each_cpu(k, policy->cpus) { | 542 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
548 | if (!cpu_online(k)) | ||
549 | continue; | ||
550 | freqs.cpu = k; | ||
551 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
552 | } | ||
553 | 543 | ||
554 | if (unlikely(retval)) { | 544 | if (unlikely(retval)) { |
555 | /* | 545 | /* |
@@ -565,12 +555,8 @@ static int centrino_target (struct cpufreq_policy *policy, | |||
565 | tmp = freqs.new; | 555 | tmp = freqs.new; |
566 | freqs.new = freqs.old; | 556 | freqs.new = freqs.old; |
567 | freqs.old = tmp; | 557 | freqs.old = tmp; |
568 | for_each_cpu(j, policy->cpus) { | 558 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
569 | if (!cpu_online(j)) | 559 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
570 | continue; | ||
571 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
572 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
573 | } | ||
574 | } | 560 | } |
575 | retval = 0; | 561 | retval = 0; |
576 | 562 | ||
diff --git a/drivers/cpufreq/speedstep-ich.c b/drivers/cpufreq/speedstep-ich.c index e29b59aa68a8..e2e5aa971452 100644 --- a/drivers/cpufreq/speedstep-ich.c +++ b/drivers/cpufreq/speedstep-ich.c | |||
@@ -263,7 +263,6 @@ static int speedstep_target(struct cpufreq_policy *policy, | |||
263 | { | 263 | { |
264 | unsigned int newstate = 0, policy_cpu; | 264 | unsigned int newstate = 0, policy_cpu; |
265 | struct cpufreq_freqs freqs; | 265 | struct cpufreq_freqs freqs; |
266 | int i; | ||
267 | 266 | ||
268 | if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], | 267 | if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], |
269 | target_freq, relation, &newstate)) | 268 | target_freq, relation, &newstate)) |
@@ -272,7 +271,6 @@ static int speedstep_target(struct cpufreq_policy *policy, | |||
272 | policy_cpu = cpumask_any_and(policy->cpus, cpu_online_mask); | 271 | policy_cpu = cpumask_any_and(policy->cpus, cpu_online_mask); |
273 | freqs.old = speedstep_get(policy_cpu); | 272 | freqs.old = speedstep_get(policy_cpu); |
274 | freqs.new = speedstep_freqs[newstate].frequency; | 273 | freqs.new = speedstep_freqs[newstate].frequency; |
275 | freqs.cpu = policy->cpu; | ||
276 | 274 | ||
277 | pr_debug("transiting from %u to %u kHz\n", freqs.old, freqs.new); | 275 | pr_debug("transiting from %u to %u kHz\n", freqs.old, freqs.new); |
278 | 276 | ||
@@ -280,18 +278,12 @@ static int speedstep_target(struct cpufreq_policy *policy, | |||
280 | if (freqs.old == freqs.new) | 278 | if (freqs.old == freqs.new) |
281 | return 0; | 279 | return 0; |
282 | 280 | ||
283 | for_each_cpu(i, policy->cpus) { | 281 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
284 | freqs.cpu = i; | ||
285 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
286 | } | ||
287 | 282 | ||
288 | smp_call_function_single(policy_cpu, _speedstep_set_state, &newstate, | 283 | smp_call_function_single(policy_cpu, _speedstep_set_state, &newstate, |
289 | true); | 284 | true); |
290 | 285 | ||
291 | for_each_cpu(i, policy->cpus) { | 286 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
292 | freqs.cpu = i; | ||
293 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
294 | } | ||
295 | 287 | ||
296 | return 0; | 288 | return 0; |
297 | } | 289 | } |
diff --git a/drivers/cpufreq/speedstep-smi.c b/drivers/cpufreq/speedstep-smi.c index 6a457fcaaad5..f5a6b70ee6c0 100644 --- a/drivers/cpufreq/speedstep-smi.c +++ b/drivers/cpufreq/speedstep-smi.c | |||
@@ -252,14 +252,13 @@ static int speedstep_target(struct cpufreq_policy *policy, | |||
252 | 252 | ||
253 | freqs.old = speedstep_freqs[speedstep_get_state()].frequency; | 253 | freqs.old = speedstep_freqs[speedstep_get_state()].frequency; |
254 | freqs.new = speedstep_freqs[newstate].frequency; | 254 | freqs.new = speedstep_freqs[newstate].frequency; |
255 | freqs.cpu = 0; /* speedstep.c is UP only driver */ | ||
256 | 255 | ||
257 | if (freqs.old == freqs.new) | 256 | if (freqs.old == freqs.new) |
258 | return 0; | 257 | return 0; |
259 | 258 | ||
260 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 259 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); |
261 | speedstep_set_state(newstate); | 260 | speedstep_set_state(newstate); |
262 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 261 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); |
263 | 262 | ||
264 | return 0; | 263 | return 0; |
265 | } | 264 | } |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 4bbc572dd521..037d36ae63e5 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -278,8 +278,8 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data); | |||
278 | int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); | 278 | int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); |
279 | 279 | ||
280 | 280 | ||
281 | void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state); | 281 | void cpufreq_notify_transition(struct cpufreq_policy *policy, |
282 | 282 | struct cpufreq_freqs *freqs, unsigned int state); | |
283 | 283 | ||
284 | static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max) | 284 | static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max) |
285 | { | 285 | { |