diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 45 |
1 files changed, 26 insertions, 19 deletions
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 | ||