diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 215 |
1 files changed, 59 insertions, 156 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 2dafc5c38ae7..0a5bea9e3585 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -32,9 +32,6 @@ | |||
32 | 32 | ||
33 | #include <trace/events/power.h> | 33 | #include <trace/events/power.h> |
34 | 34 | ||
35 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_CORE, \ | ||
36 | "cpufreq-core", msg) | ||
37 | |||
38 | /** | 35 | /** |
39 | * The "cpufreq driver" - the arch- or hardware-dependent low | 36 | * The "cpufreq driver" - the arch- or hardware-dependent low |
40 | * level driver of CPUFreq support, and its spinlock. This lock | 37 | * level driver of CPUFreq support, and its spinlock. This lock |
@@ -181,93 +178,6 @@ EXPORT_SYMBOL_GPL(cpufreq_cpu_put); | |||
181 | 178 | ||
182 | 179 | ||
183 | /********************************************************************* | 180 | /********************************************************************* |
184 | * UNIFIED DEBUG HELPERS * | ||
185 | *********************************************************************/ | ||
186 | #ifdef CONFIG_CPU_FREQ_DEBUG | ||
187 | |||
188 | /* what part(s) of the CPUfreq subsystem are debugged? */ | ||
189 | static unsigned int debug; | ||
190 | |||
191 | /* is the debug output ratelimit'ed using printk_ratelimit? User can | ||
192 | * set or modify this value. | ||
193 | */ | ||
194 | static unsigned int debug_ratelimit = 1; | ||
195 | |||
196 | /* is the printk_ratelimit'ing enabled? It's enabled after a successful | ||
197 | * loading of a cpufreq driver, temporarily disabled when a new policy | ||
198 | * is set, and disabled upon cpufreq driver removal | ||
199 | */ | ||
200 | static unsigned int disable_ratelimit = 1; | ||
201 | static DEFINE_SPINLOCK(disable_ratelimit_lock); | ||
202 | |||
203 | static void cpufreq_debug_enable_ratelimit(void) | ||
204 | { | ||
205 | unsigned long flags; | ||
206 | |||
207 | spin_lock_irqsave(&disable_ratelimit_lock, flags); | ||
208 | if (disable_ratelimit) | ||
209 | disable_ratelimit--; | ||
210 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); | ||
211 | } | ||
212 | |||
213 | static void cpufreq_debug_disable_ratelimit(void) | ||
214 | { | ||
215 | unsigned long flags; | ||
216 | |||
217 | spin_lock_irqsave(&disable_ratelimit_lock, flags); | ||
218 | disable_ratelimit++; | ||
219 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); | ||
220 | } | ||
221 | |||
222 | void cpufreq_debug_printk(unsigned int type, const char *prefix, | ||
223 | const char *fmt, ...) | ||
224 | { | ||
225 | char s[256]; | ||
226 | va_list args; | ||
227 | unsigned int len; | ||
228 | unsigned long flags; | ||
229 | |||
230 | WARN_ON(!prefix); | ||
231 | if (type & debug) { | ||
232 | spin_lock_irqsave(&disable_ratelimit_lock, flags); | ||
233 | if (!disable_ratelimit && debug_ratelimit | ||
234 | && !printk_ratelimit()) { | ||
235 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); | ||
236 | return; | ||
237 | } | ||
238 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); | ||
239 | |||
240 | len = snprintf(s, 256, KERN_DEBUG "%s: ", prefix); | ||
241 | |||
242 | va_start(args, fmt); | ||
243 | len += vsnprintf(&s[len], (256 - len), fmt, args); | ||
244 | va_end(args); | ||
245 | |||
246 | printk(s); | ||
247 | |||
248 | WARN_ON(len < 5); | ||
249 | } | ||
250 | } | ||
251 | EXPORT_SYMBOL(cpufreq_debug_printk); | ||
252 | |||
253 | |||
254 | module_param(debug, uint, 0644); | ||
255 | MODULE_PARM_DESC(debug, "CPUfreq debugging: add 1 to debug core," | ||
256 | " 2 to debug drivers, and 4 to debug governors."); | ||
257 | |||
258 | module_param(debug_ratelimit, uint, 0644); | ||
259 | MODULE_PARM_DESC(debug_ratelimit, "CPUfreq debugging:" | ||
260 | " set to 0 to disable ratelimiting."); | ||
261 | |||
262 | #else /* !CONFIG_CPU_FREQ_DEBUG */ | ||
263 | |||
264 | static inline void cpufreq_debug_enable_ratelimit(void) { return; } | ||
265 | static inline void cpufreq_debug_disable_ratelimit(void) { return; } | ||
266 | |||
267 | #endif /* CONFIG_CPU_FREQ_DEBUG */ | ||
268 | |||
269 | |||
270 | /********************************************************************* | ||
271 | * EXTERNALLY AFFECTING FREQUENCY CHANGES * | 181 | * EXTERNALLY AFFECTING FREQUENCY CHANGES * |
272 | *********************************************************************/ | 182 | *********************************************************************/ |
273 | 183 | ||
@@ -291,7 +201,7 @@ static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) | |||
291 | if (!l_p_j_ref_freq) { | 201 | if (!l_p_j_ref_freq) { |
292 | l_p_j_ref = loops_per_jiffy; | 202 | l_p_j_ref = loops_per_jiffy; |
293 | l_p_j_ref_freq = ci->old; | 203 | l_p_j_ref_freq = ci->old; |
294 | dprintk("saving %lu as reference value for loops_per_jiffy; " | 204 | pr_debug("saving %lu as reference value for loops_per_jiffy; " |
295 | "freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq); | 205 | "freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq); |
296 | } | 206 | } |
297 | if ((val == CPUFREQ_PRECHANGE && ci->old < ci->new) || | 207 | if ((val == CPUFREQ_PRECHANGE && ci->old < ci->new) || |
@@ -299,7 +209,7 @@ static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) | |||
299 | (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { | 209 | (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { |
300 | loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, | 210 | loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, |
301 | ci->new); | 211 | ci->new); |
302 | dprintk("scaling loops_per_jiffy to %lu " | 212 | pr_debug("scaling loops_per_jiffy to %lu " |
303 | "for frequency %u kHz\n", loops_per_jiffy, ci->new); | 213 | "for frequency %u kHz\n", loops_per_jiffy, ci->new); |
304 | } | 214 | } |
305 | } | 215 | } |
@@ -326,7 +236,7 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state) | |||
326 | BUG_ON(irqs_disabled()); | 236 | BUG_ON(irqs_disabled()); |
327 | 237 | ||
328 | freqs->flags = cpufreq_driver->flags; | 238 | freqs->flags = cpufreq_driver->flags; |
329 | dprintk("notification %u of frequency transition to %u kHz\n", | 239 | pr_debug("notification %u of frequency transition to %u kHz\n", |
330 | state, freqs->new); | 240 | state, freqs->new); |
331 | 241 | ||
332 | policy = per_cpu(cpufreq_cpu_data, freqs->cpu); | 242 | policy = per_cpu(cpufreq_cpu_data, freqs->cpu); |
@@ -340,7 +250,7 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state) | |||
340 | if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { | 250 | if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { |
341 | if ((policy) && (policy->cpu == freqs->cpu) && | 251 | if ((policy) && (policy->cpu == freqs->cpu) && |
342 | (policy->cur) && (policy->cur != freqs->old)) { | 252 | (policy->cur) && (policy->cur != freqs->old)) { |
343 | dprintk("Warning: CPU frequency is" | 253 | pr_debug("Warning: CPU frequency is" |
344 | " %u, cpufreq assumed %u kHz.\n", | 254 | " %u, cpufreq assumed %u kHz.\n", |
345 | freqs->old, policy->cur); | 255 | freqs->old, policy->cur); |
346 | freqs->old = policy->cur; | 256 | freqs->old = policy->cur; |
@@ -353,7 +263,7 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state) | |||
353 | 263 | ||
354 | case CPUFREQ_POSTCHANGE: | 264 | case CPUFREQ_POSTCHANGE: |
355 | adjust_jiffies(CPUFREQ_POSTCHANGE, freqs); | 265 | adjust_jiffies(CPUFREQ_POSTCHANGE, freqs); |
356 | dprintk("FREQ: %lu - CPU: %lu", (unsigned long)freqs->new, | 266 | pr_debug("FREQ: %lu - CPU: %lu", (unsigned long)freqs->new, |
357 | (unsigned long)freqs->cpu); | 267 | (unsigned long)freqs->cpu); |
358 | trace_power_frequency(POWER_PSTATE, freqs->new, freqs->cpu); | 268 | trace_power_frequency(POWER_PSTATE, freqs->new, freqs->cpu); |
359 | trace_cpu_frequency(freqs->new, freqs->cpu); | 269 | trace_cpu_frequency(freqs->new, freqs->cpu); |
@@ -411,21 +321,14 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy, | |||
411 | t = __find_governor(str_governor); | 321 | t = __find_governor(str_governor); |
412 | 322 | ||
413 | if (t == NULL) { | 323 | if (t == NULL) { |
414 | char *name = kasprintf(GFP_KERNEL, "cpufreq_%s", | 324 | int ret; |
415 | str_governor); | ||
416 | |||
417 | if (name) { | ||
418 | int ret; | ||
419 | 325 | ||
420 | mutex_unlock(&cpufreq_governor_mutex); | 326 | mutex_unlock(&cpufreq_governor_mutex); |
421 | ret = request_module("%s", name); | 327 | ret = request_module("cpufreq_%s", str_governor); |
422 | mutex_lock(&cpufreq_governor_mutex); | 328 | mutex_lock(&cpufreq_governor_mutex); |
423 | 329 | ||
424 | if (ret == 0) | 330 | if (ret == 0) |
425 | t = __find_governor(str_governor); | 331 | t = __find_governor(str_governor); |
426 | } | ||
427 | |||
428 | kfree(name); | ||
429 | } | 332 | } |
430 | 333 | ||
431 | if (t != NULL) { | 334 | if (t != NULL) { |
@@ -753,7 +656,7 @@ no_policy: | |||
753 | static void cpufreq_sysfs_release(struct kobject *kobj) | 656 | static void cpufreq_sysfs_release(struct kobject *kobj) |
754 | { | 657 | { |
755 | struct cpufreq_policy *policy = to_policy(kobj); | 658 | struct cpufreq_policy *policy = to_policy(kobj); |
756 | dprintk("last reference is dropped\n"); | 659 | pr_debug("last reference is dropped\n"); |
757 | complete(&policy->kobj_unregister); | 660 | complete(&policy->kobj_unregister); |
758 | } | 661 | } |
759 | 662 | ||
@@ -788,7 +691,7 @@ static int cpufreq_add_dev_policy(unsigned int cpu, | |||
788 | gov = __find_governor(per_cpu(cpufreq_cpu_governor, cpu)); | 691 | gov = __find_governor(per_cpu(cpufreq_cpu_governor, cpu)); |
789 | if (gov) { | 692 | if (gov) { |
790 | policy->governor = gov; | 693 | policy->governor = gov; |
791 | dprintk("Restoring governor %s for cpu %d\n", | 694 | pr_debug("Restoring governor %s for cpu %d\n", |
792 | policy->governor->name, cpu); | 695 | policy->governor->name, cpu); |
793 | } | 696 | } |
794 | #endif | 697 | #endif |
@@ -824,7 +727,7 @@ static int cpufreq_add_dev_policy(unsigned int cpu, | |||
824 | per_cpu(cpufreq_cpu_data, cpu) = managed_policy; | 727 | per_cpu(cpufreq_cpu_data, cpu) = managed_policy; |
825 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 728 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
826 | 729 | ||
827 | dprintk("CPU already managed, adding link\n"); | 730 | pr_debug("CPU already managed, adding link\n"); |
828 | ret = sysfs_create_link(&sys_dev->kobj, | 731 | ret = sysfs_create_link(&sys_dev->kobj, |
829 | &managed_policy->kobj, | 732 | &managed_policy->kobj, |
830 | "cpufreq"); | 733 | "cpufreq"); |
@@ -865,7 +768,7 @@ static int cpufreq_add_dev_symlink(unsigned int cpu, | |||
865 | if (!cpu_online(j)) | 768 | if (!cpu_online(j)) |
866 | continue; | 769 | continue; |
867 | 770 | ||
868 | dprintk("CPU %u already managed, adding link\n", j); | 771 | pr_debug("CPU %u already managed, adding link\n", j); |
869 | managed_policy = cpufreq_cpu_get(cpu); | 772 | managed_policy = cpufreq_cpu_get(cpu); |
870 | cpu_sys_dev = get_cpu_sysdev(j); | 773 | cpu_sys_dev = get_cpu_sysdev(j); |
871 | ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, | 774 | ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, |
@@ -941,7 +844,7 @@ static int cpufreq_add_dev_interface(unsigned int cpu, | |||
941 | policy->user_policy.governor = policy->governor; | 844 | policy->user_policy.governor = policy->governor; |
942 | 845 | ||
943 | if (ret) { | 846 | if (ret) { |
944 | dprintk("setting policy failed\n"); | 847 | pr_debug("setting policy failed\n"); |
945 | if (cpufreq_driver->exit) | 848 | if (cpufreq_driver->exit) |
946 | cpufreq_driver->exit(policy); | 849 | cpufreq_driver->exit(policy); |
947 | } | 850 | } |
@@ -977,8 +880,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
977 | if (cpu_is_offline(cpu)) | 880 | if (cpu_is_offline(cpu)) |
978 | return 0; | 881 | return 0; |
979 | 882 | ||
980 | cpufreq_debug_disable_ratelimit(); | 883 | pr_debug("adding CPU %u\n", cpu); |
981 | dprintk("adding CPU %u\n", cpu); | ||
982 | 884 | ||
983 | #ifdef CONFIG_SMP | 885 | #ifdef CONFIG_SMP |
984 | /* check whether a different CPU already registered this | 886 | /* check whether a different CPU already registered this |
@@ -986,7 +888,6 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
986 | policy = cpufreq_cpu_get(cpu); | 888 | policy = cpufreq_cpu_get(cpu); |
987 | if (unlikely(policy)) { | 889 | if (unlikely(policy)) { |
988 | cpufreq_cpu_put(policy); | 890 | cpufreq_cpu_put(policy); |
989 | cpufreq_debug_enable_ratelimit(); | ||
990 | return 0; | 891 | return 0; |
991 | } | 892 | } |
992 | #endif | 893 | #endif |
@@ -1037,7 +938,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
1037 | */ | 938 | */ |
1038 | ret = cpufreq_driver->init(policy); | 939 | ret = cpufreq_driver->init(policy); |
1039 | if (ret) { | 940 | if (ret) { |
1040 | dprintk("initialization failed\n"); | 941 | pr_debug("initialization failed\n"); |
1041 | goto err_unlock_policy; | 942 | goto err_unlock_policy; |
1042 | } | 943 | } |
1043 | policy->user_policy.min = policy->min; | 944 | policy->user_policy.min = policy->min; |
@@ -1063,8 +964,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
1063 | 964 | ||
1064 | kobject_uevent(&policy->kobj, KOBJ_ADD); | 965 | kobject_uevent(&policy->kobj, KOBJ_ADD); |
1065 | module_put(cpufreq_driver->owner); | 966 | module_put(cpufreq_driver->owner); |
1066 | dprintk("initialization complete\n"); | 967 | pr_debug("initialization complete\n"); |
1067 | cpufreq_debug_enable_ratelimit(); | ||
1068 | 968 | ||
1069 | return 0; | 969 | return 0; |
1070 | 970 | ||
@@ -1088,7 +988,6 @@ err_free_policy: | |||
1088 | nomem_out: | 988 | nomem_out: |
1089 | module_put(cpufreq_driver->owner); | 989 | module_put(cpufreq_driver->owner); |
1090 | module_out: | 990 | module_out: |
1091 | cpufreq_debug_enable_ratelimit(); | ||
1092 | return ret; | 991 | return ret; |
1093 | } | 992 | } |
1094 | 993 | ||
@@ -1112,15 +1011,13 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) | |||
1112 | unsigned int j; | 1011 | unsigned int j; |
1113 | #endif | 1012 | #endif |
1114 | 1013 | ||
1115 | cpufreq_debug_disable_ratelimit(); | 1014 | pr_debug("unregistering CPU %u\n", cpu); |
1116 | dprintk("unregistering CPU %u\n", cpu); | ||
1117 | 1015 | ||
1118 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | 1016 | spin_lock_irqsave(&cpufreq_driver_lock, flags); |
1119 | data = per_cpu(cpufreq_cpu_data, cpu); | 1017 | data = per_cpu(cpufreq_cpu_data, cpu); |
1120 | 1018 | ||
1121 | if (!data) { | 1019 | if (!data) { |
1122 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1020 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
1123 | cpufreq_debug_enable_ratelimit(); | ||
1124 | unlock_policy_rwsem_write(cpu); | 1021 | unlock_policy_rwsem_write(cpu); |
1125 | return -EINVAL; | 1022 | return -EINVAL; |
1126 | } | 1023 | } |
@@ -1132,12 +1029,11 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) | |||
1132 | * only need to unlink, put and exit | 1029 | * only need to unlink, put and exit |
1133 | */ | 1030 | */ |
1134 | if (unlikely(cpu != data->cpu)) { | 1031 | if (unlikely(cpu != data->cpu)) { |
1135 | dprintk("removing link\n"); | 1032 | pr_debug("removing link\n"); |
1136 | cpumask_clear_cpu(cpu, data->cpus); | 1033 | cpumask_clear_cpu(cpu, data->cpus); |
1137 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1034 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
1138 | kobj = &sys_dev->kobj; | 1035 | kobj = &sys_dev->kobj; |
1139 | cpufreq_cpu_put(data); | 1036 | cpufreq_cpu_put(data); |
1140 | cpufreq_debug_enable_ratelimit(); | ||
1141 | unlock_policy_rwsem_write(cpu); | 1037 | unlock_policy_rwsem_write(cpu); |
1142 | sysfs_remove_link(kobj, "cpufreq"); | 1038 | sysfs_remove_link(kobj, "cpufreq"); |
1143 | return 0; | 1039 | return 0; |
@@ -1170,7 +1066,7 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) | |||
1170 | for_each_cpu(j, data->cpus) { | 1066 | for_each_cpu(j, data->cpus) { |
1171 | if (j == cpu) | 1067 | if (j == cpu) |
1172 | continue; | 1068 | continue; |
1173 | dprintk("removing link for cpu %u\n", j); | 1069 | pr_debug("removing link for cpu %u\n", j); |
1174 | #ifdef CONFIG_HOTPLUG_CPU | 1070 | #ifdef CONFIG_HOTPLUG_CPU |
1175 | strncpy(per_cpu(cpufreq_cpu_governor, j), | 1071 | strncpy(per_cpu(cpufreq_cpu_governor, j), |
1176 | data->governor->name, CPUFREQ_NAME_LEN); | 1072 | data->governor->name, CPUFREQ_NAME_LEN); |
@@ -1199,21 +1095,35 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) | |||
1199 | * not referenced anymore by anybody before we proceed with | 1095 | * not referenced anymore by anybody before we proceed with |
1200 | * unloading. | 1096 | * unloading. |
1201 | */ | 1097 | */ |
1202 | dprintk("waiting for dropping of refcount\n"); | 1098 | pr_debug("waiting for dropping of refcount\n"); |
1203 | wait_for_completion(cmp); | 1099 | wait_for_completion(cmp); |
1204 | dprintk("wait complete\n"); | 1100 | pr_debug("wait complete\n"); |
1205 | 1101 | ||
1206 | lock_policy_rwsem_write(cpu); | 1102 | lock_policy_rwsem_write(cpu); |
1207 | if (cpufreq_driver->exit) | 1103 | if (cpufreq_driver->exit) |
1208 | cpufreq_driver->exit(data); | 1104 | cpufreq_driver->exit(data); |
1209 | unlock_policy_rwsem_write(cpu); | 1105 | unlock_policy_rwsem_write(cpu); |
1210 | 1106 | ||
1107 | #ifdef CONFIG_HOTPLUG_CPU | ||
1108 | /* when the CPU which is the parent of the kobj is hotplugged | ||
1109 | * offline, check for siblings, and create cpufreq sysfs interface | ||
1110 | * and symlinks | ||
1111 | */ | ||
1112 | if (unlikely(cpumask_weight(data->cpus) > 1)) { | ||
1113 | /* first sibling now owns the new sysfs dir */ | ||
1114 | cpumask_clear_cpu(cpu, data->cpus); | ||
1115 | cpufreq_add_dev(get_cpu_sysdev(cpumask_first(data->cpus))); | ||
1116 | |||
1117 | /* finally remove our own symlink */ | ||
1118 | lock_policy_rwsem_write(cpu); | ||
1119 | __cpufreq_remove_dev(sys_dev); | ||
1120 | } | ||
1121 | #endif | ||
1122 | |||
1211 | free_cpumask_var(data->related_cpus); | 1123 | free_cpumask_var(data->related_cpus); |
1212 | free_cpumask_var(data->cpus); | 1124 | free_cpumask_var(data->cpus); |
1213 | kfree(data); | 1125 | kfree(data); |
1214 | per_cpu(cpufreq_cpu_data, cpu) = NULL; | ||
1215 | 1126 | ||
1216 | cpufreq_debug_enable_ratelimit(); | ||
1217 | return 0; | 1127 | return 0; |
1218 | } | 1128 | } |
1219 | 1129 | ||
@@ -1239,7 +1149,7 @@ static void handle_update(struct work_struct *work) | |||
1239 | struct cpufreq_policy *policy = | 1149 | struct cpufreq_policy *policy = |
1240 | container_of(work, struct cpufreq_policy, update); | 1150 | container_of(work, struct cpufreq_policy, update); |
1241 | unsigned int cpu = policy->cpu; | 1151 | unsigned int cpu = policy->cpu; |
1242 | dprintk("handle_update for cpu %u called\n", cpu); | 1152 | pr_debug("handle_update for cpu %u called\n", cpu); |
1243 | cpufreq_update_policy(cpu); | 1153 | cpufreq_update_policy(cpu); |
1244 | } | 1154 | } |
1245 | 1155 | ||
@@ -1257,7 +1167,7 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, | |||
1257 | { | 1167 | { |
1258 | struct cpufreq_freqs freqs; | 1168 | struct cpufreq_freqs freqs; |
1259 | 1169 | ||
1260 | dprintk("Warning: CPU frequency out of sync: cpufreq and timing " | 1170 | pr_debug("Warning: CPU frequency out of sync: cpufreq and timing " |
1261 | "core thinks of %u, is %u kHz.\n", old_freq, new_freq); | 1171 | "core thinks of %u, is %u kHz.\n", old_freq, new_freq); |
1262 | 1172 | ||
1263 | freqs.cpu = cpu; | 1173 | freqs.cpu = cpu; |
@@ -1360,7 +1270,7 @@ static int cpufreq_bp_suspend(void) | |||
1360 | int cpu = smp_processor_id(); | 1270 | int cpu = smp_processor_id(); |
1361 | struct cpufreq_policy *cpu_policy; | 1271 | struct cpufreq_policy *cpu_policy; |
1362 | 1272 | ||
1363 | dprintk("suspending cpu %u\n", cpu); | 1273 | pr_debug("suspending cpu %u\n", cpu); |
1364 | 1274 | ||
1365 | /* If there's no policy for the boot CPU, we have nothing to do. */ | 1275 | /* If there's no policy for the boot CPU, we have nothing to do. */ |
1366 | cpu_policy = cpufreq_cpu_get(cpu); | 1276 | cpu_policy = cpufreq_cpu_get(cpu); |
@@ -1398,7 +1308,7 @@ static void cpufreq_bp_resume(void) | |||
1398 | int cpu = smp_processor_id(); | 1308 | int cpu = smp_processor_id(); |
1399 | struct cpufreq_policy *cpu_policy; | 1309 | struct cpufreq_policy *cpu_policy; |
1400 | 1310 | ||
1401 | dprintk("resuming cpu %u\n", cpu); | 1311 | pr_debug("resuming cpu %u\n", cpu); |
1402 | 1312 | ||
1403 | /* If there's no policy for the boot CPU, we have nothing to do. */ | 1313 | /* If there's no policy for the boot CPU, we have nothing to do. */ |
1404 | cpu_policy = cpufreq_cpu_get(cpu); | 1314 | cpu_policy = cpufreq_cpu_get(cpu); |
@@ -1510,7 +1420,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, | |||
1510 | { | 1420 | { |
1511 | int retval = -EINVAL; | 1421 | int retval = -EINVAL; |
1512 | 1422 | ||
1513 | dprintk("target for CPU %u: %u kHz, relation %u\n", policy->cpu, | 1423 | pr_debug("target for CPU %u: %u kHz, relation %u\n", policy->cpu, |
1514 | target_freq, relation); | 1424 | target_freq, relation); |
1515 | if (cpu_online(policy->cpu) && cpufreq_driver->target) | 1425 | if (cpu_online(policy->cpu) && cpufreq_driver->target) |
1516 | retval = cpufreq_driver->target(policy, target_freq, relation); | 1426 | retval = cpufreq_driver->target(policy, target_freq, relation); |
@@ -1596,7 +1506,7 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, | |||
1596 | if (!try_module_get(policy->governor->owner)) | 1506 | if (!try_module_get(policy->governor->owner)) |
1597 | return -EINVAL; | 1507 | return -EINVAL; |
1598 | 1508 | ||
1599 | dprintk("__cpufreq_governor for CPU %u, event %u\n", | 1509 | pr_debug("__cpufreq_governor for CPU %u, event %u\n", |
1600 | policy->cpu, event); | 1510 | policy->cpu, event); |
1601 | ret = policy->governor->governor(policy, event); | 1511 | ret = policy->governor->governor(policy, event); |
1602 | 1512 | ||
@@ -1697,8 +1607,7 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, | |||
1697 | { | 1607 | { |
1698 | int ret = 0; | 1608 | int ret = 0; |
1699 | 1609 | ||
1700 | cpufreq_debug_disable_ratelimit(); | 1610 | pr_debug("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu, |
1701 | dprintk("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu, | ||
1702 | policy->min, policy->max); | 1611 | policy->min, policy->max); |
1703 | 1612 | ||
1704 | memcpy(&policy->cpuinfo, &data->cpuinfo, | 1613 | memcpy(&policy->cpuinfo, &data->cpuinfo, |
@@ -1735,19 +1644,19 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, | |||
1735 | data->min = policy->min; | 1644 | data->min = policy->min; |
1736 | data->max = policy->max; | 1645 | data->max = policy->max; |
1737 | 1646 | ||
1738 | dprintk("new min and max freqs are %u - %u kHz\n", | 1647 | pr_debug("new min and max freqs are %u - %u kHz\n", |
1739 | data->min, data->max); | 1648 | data->min, data->max); |
1740 | 1649 | ||
1741 | if (cpufreq_driver->setpolicy) { | 1650 | if (cpufreq_driver->setpolicy) { |
1742 | data->policy = policy->policy; | 1651 | data->policy = policy->policy; |
1743 | dprintk("setting range\n"); | 1652 | pr_debug("setting range\n"); |
1744 | ret = cpufreq_driver->setpolicy(policy); | 1653 | ret = cpufreq_driver->setpolicy(policy); |
1745 | } else { | 1654 | } else { |
1746 | if (policy->governor != data->governor) { | 1655 | if (policy->governor != data->governor) { |
1747 | /* save old, working values */ | 1656 | /* save old, working values */ |
1748 | struct cpufreq_governor *old_gov = data->governor; | 1657 | struct cpufreq_governor *old_gov = data->governor; |
1749 | 1658 | ||
1750 | dprintk("governor switch\n"); | 1659 | pr_debug("governor switch\n"); |
1751 | 1660 | ||
1752 | /* end old governor */ | 1661 | /* end old governor */ |
1753 | if (data->governor) | 1662 | if (data->governor) |
@@ -1757,7 +1666,7 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, | |||
1757 | data->governor = policy->governor; | 1666 | data->governor = policy->governor; |
1758 | if (__cpufreq_governor(data, CPUFREQ_GOV_START)) { | 1667 | if (__cpufreq_governor(data, CPUFREQ_GOV_START)) { |
1759 | /* new governor failed, so re-start old one */ | 1668 | /* new governor failed, so re-start old one */ |
1760 | dprintk("starting governor %s failed\n", | 1669 | pr_debug("starting governor %s failed\n", |
1761 | data->governor->name); | 1670 | data->governor->name); |
1762 | if (old_gov) { | 1671 | if (old_gov) { |
1763 | data->governor = old_gov; | 1672 | data->governor = old_gov; |
@@ -1769,12 +1678,11 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, | |||
1769 | } | 1678 | } |
1770 | /* might be a policy change, too, so fall through */ | 1679 | /* might be a policy change, too, so fall through */ |
1771 | } | 1680 | } |
1772 | dprintk("governor: change or update limits\n"); | 1681 | pr_debug("governor: change or update limits\n"); |
1773 | __cpufreq_governor(data, CPUFREQ_GOV_LIMITS); | 1682 | __cpufreq_governor(data, CPUFREQ_GOV_LIMITS); |
1774 | } | 1683 | } |
1775 | 1684 | ||
1776 | error_out: | 1685 | error_out: |
1777 | cpufreq_debug_enable_ratelimit(); | ||
1778 | return ret; | 1686 | return ret; |
1779 | } | 1687 | } |
1780 | 1688 | ||
@@ -1801,7 +1709,7 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1801 | goto fail; | 1709 | goto fail; |
1802 | } | 1710 | } |
1803 | 1711 | ||
1804 | dprintk("updating policy for CPU %u\n", cpu); | 1712 | pr_debug("updating policy for CPU %u\n", cpu); |
1805 | memcpy(&policy, data, sizeof(struct cpufreq_policy)); | 1713 | memcpy(&policy, data, sizeof(struct cpufreq_policy)); |
1806 | policy.min = data->user_policy.min; | 1714 | policy.min = data->user_policy.min; |
1807 | policy.max = data->user_policy.max; | 1715 | policy.max = data->user_policy.max; |
@@ -1813,7 +1721,7 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1813 | if (cpufreq_driver->get) { | 1721 | if (cpufreq_driver->get) { |
1814 | policy.cur = cpufreq_driver->get(cpu); | 1722 | policy.cur = cpufreq_driver->get(cpu); |
1815 | if (!data->cur) { | 1723 | if (!data->cur) { |
1816 | dprintk("Driver did not initialize current freq"); | 1724 | pr_debug("Driver did not initialize current freq"); |
1817 | data->cur = policy.cur; | 1725 | data->cur = policy.cur; |
1818 | } else { | 1726 | } else { |
1819 | if (data->cur != policy.cur) | 1727 | if (data->cur != policy.cur) |
@@ -1889,7 +1797,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
1889 | ((!driver_data->setpolicy) && (!driver_data->target))) | 1797 | ((!driver_data->setpolicy) && (!driver_data->target))) |
1890 | return -EINVAL; | 1798 | return -EINVAL; |
1891 | 1799 | ||
1892 | dprintk("trying to register driver %s\n", driver_data->name); | 1800 | pr_debug("trying to register driver %s\n", driver_data->name); |
1893 | 1801 | ||
1894 | if (driver_data->setpolicy) | 1802 | if (driver_data->setpolicy) |
1895 | driver_data->flags |= CPUFREQ_CONST_LOOPS; | 1803 | driver_data->flags |= CPUFREQ_CONST_LOOPS; |
@@ -1920,15 +1828,14 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
1920 | 1828 | ||
1921 | /* if all ->init() calls failed, unregister */ | 1829 | /* if all ->init() calls failed, unregister */ |
1922 | if (ret) { | 1830 | if (ret) { |
1923 | dprintk("no CPU initialized for driver %s\n", | 1831 | pr_debug("no CPU initialized for driver %s\n", |
1924 | driver_data->name); | 1832 | driver_data->name); |
1925 | goto err_sysdev_unreg; | 1833 | goto err_sysdev_unreg; |
1926 | } | 1834 | } |
1927 | } | 1835 | } |
1928 | 1836 | ||
1929 | register_hotcpu_notifier(&cpufreq_cpu_notifier); | 1837 | register_hotcpu_notifier(&cpufreq_cpu_notifier); |
1930 | dprintk("driver %s up and running\n", driver_data->name); | 1838 | pr_debug("driver %s up and running\n", driver_data->name); |
1931 | cpufreq_debug_enable_ratelimit(); | ||
1932 | 1839 | ||
1933 | return 0; | 1840 | return 0; |
1934 | err_sysdev_unreg: | 1841 | err_sysdev_unreg: |
@@ -1955,14 +1862,10 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) | |||
1955 | { | 1862 | { |
1956 | unsigned long flags; | 1863 | unsigned long flags; |
1957 | 1864 | ||
1958 | cpufreq_debug_disable_ratelimit(); | 1865 | if (!cpufreq_driver || (driver != cpufreq_driver)) |
1959 | |||
1960 | if (!cpufreq_driver || (driver != cpufreq_driver)) { | ||
1961 | cpufreq_debug_enable_ratelimit(); | ||
1962 | return -EINVAL; | 1866 | return -EINVAL; |
1963 | } | ||
1964 | 1867 | ||
1965 | dprintk("unregistering driver %s\n", driver->name); | 1868 | pr_debug("unregistering driver %s\n", driver->name); |
1966 | 1869 | ||
1967 | sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); | 1870 | sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); |
1968 | unregister_hotcpu_notifier(&cpufreq_cpu_notifier); | 1871 | unregister_hotcpu_notifier(&cpufreq_cpu_notifier); |