diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 153 |
1 files changed, 109 insertions, 44 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 47ab42db122a..9fb2edf36611 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -29,7 +29,8 @@ | |||
29 | #include <linux/completion.h> | 29 | #include <linux/completion.h> |
30 | #include <linux/mutex.h> | 30 | #include <linux/mutex.h> |
31 | 31 | ||
32 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_CORE, "cpufreq-core", msg) | 32 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_CORE, \ |
33 | "cpufreq-core", msg) | ||
33 | 34 | ||
34 | /** | 35 | /** |
35 | * The "cpufreq driver" - the arch- or hardware-dependent low | 36 | * The "cpufreq driver" - the arch- or hardware-dependent low |
@@ -151,7 +152,8 @@ static void cpufreq_debug_disable_ratelimit(void) | |||
151 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); | 152 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); |
152 | } | 153 | } |
153 | 154 | ||
154 | void cpufreq_debug_printk(unsigned int type, const char *prefix, const char *fmt, ...) | 155 | void cpufreq_debug_printk(unsigned int type, const char *prefix, |
156 | const char *fmt, ...) | ||
155 | { | 157 | { |
156 | char s[256]; | 158 | char s[256]; |
157 | va_list args; | 159 | va_list args; |
@@ -161,7 +163,8 @@ void cpufreq_debug_printk(unsigned int type, const char *prefix, const char *fmt | |||
161 | WARN_ON(!prefix); | 163 | WARN_ON(!prefix); |
162 | if (type & debug) { | 164 | if (type & debug) { |
163 | spin_lock_irqsave(&disable_ratelimit_lock, flags); | 165 | spin_lock_irqsave(&disable_ratelimit_lock, flags); |
164 | if (!disable_ratelimit && debug_ratelimit && !printk_ratelimit()) { | 166 | if (!disable_ratelimit && debug_ratelimit |
167 | && !printk_ratelimit()) { | ||
165 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); | 168 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); |
166 | return; | 169 | return; |
167 | } | 170 | } |
@@ -182,10 +185,12 @@ EXPORT_SYMBOL(cpufreq_debug_printk); | |||
182 | 185 | ||
183 | 186 | ||
184 | module_param(debug, uint, 0644); | 187 | module_param(debug, uint, 0644); |
185 | MODULE_PARM_DESC(debug, "CPUfreq debugging: add 1 to debug core, 2 to debug drivers, and 4 to debug governors."); | 188 | MODULE_PARM_DESC(debug, "CPUfreq debugging: add 1 to debug core," |
189 | " 2 to debug drivers, and 4 to debug governors."); | ||
186 | 190 | ||
187 | module_param(debug_ratelimit, uint, 0644); | 191 | module_param(debug_ratelimit, uint, 0644); |
188 | MODULE_PARM_DESC(debug_ratelimit, "CPUfreq debugging: set to 0 to disable ratelimiting."); | 192 | MODULE_PARM_DESC(debug_ratelimit, "CPUfreq debugging:" |
193 | " set to 0 to disable ratelimiting."); | ||
189 | 194 | ||
190 | #else /* !CONFIG_CPU_FREQ_DEBUG */ | 195 | #else /* !CONFIG_CPU_FREQ_DEBUG */ |
191 | 196 | ||
@@ -219,17 +224,23 @@ static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) | |||
219 | if (!l_p_j_ref_freq) { | 224 | if (!l_p_j_ref_freq) { |
220 | l_p_j_ref = loops_per_jiffy; | 225 | l_p_j_ref = loops_per_jiffy; |
221 | l_p_j_ref_freq = ci->old; | 226 | l_p_j_ref_freq = ci->old; |
222 | dprintk("saving %lu as reference value for loops_per_jiffy; freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq); | 227 | dprintk("saving %lu as reference value for loops_per_jiffy;" |
228 | "freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq); | ||
223 | } | 229 | } |
224 | if ((val == CPUFREQ_PRECHANGE && ci->old < ci->new) || | 230 | if ((val == CPUFREQ_PRECHANGE && ci->old < ci->new) || |
225 | (val == CPUFREQ_POSTCHANGE && ci->old > ci->new) || | 231 | (val == CPUFREQ_POSTCHANGE && ci->old > ci->new) || |
226 | (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { | 232 | (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { |
227 | loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, ci->new); | 233 | loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, |
228 | dprintk("scaling loops_per_jiffy to %lu for frequency %u kHz\n", loops_per_jiffy, ci->new); | 234 | ci->new); |
235 | dprintk("scaling loops_per_jiffy to %lu" | ||
236 | "for frequency %u kHz\n", loops_per_jiffy, ci->new); | ||
229 | } | 237 | } |
230 | } | 238 | } |
231 | #else | 239 | #else |
232 | static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) { return; } | 240 | static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) |
241 | { | ||
242 | return; | ||
243 | } | ||
233 | #endif | 244 | #endif |
234 | 245 | ||
235 | 246 | ||
@@ -316,7 +327,8 @@ static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, | |||
316 | if (!strnicmp(str_governor, "performance", CPUFREQ_NAME_LEN)) { | 327 | if (!strnicmp(str_governor, "performance", CPUFREQ_NAME_LEN)) { |
317 | *policy = CPUFREQ_POLICY_PERFORMANCE; | 328 | *policy = CPUFREQ_POLICY_PERFORMANCE; |
318 | err = 0; | 329 | err = 0; |
319 | } else if (!strnicmp(str_governor, "powersave", CPUFREQ_NAME_LEN)) { | 330 | } else if (!strnicmp(str_governor, "powersave", |
331 | CPUFREQ_NAME_LEN)) { | ||
320 | *policy = CPUFREQ_POLICY_POWERSAVE; | 332 | *policy = CPUFREQ_POLICY_POWERSAVE; |
321 | err = 0; | 333 | err = 0; |
322 | } | 334 | } |
@@ -328,7 +340,8 @@ static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, | |||
328 | t = __find_governor(str_governor); | 340 | t = __find_governor(str_governor); |
329 | 341 | ||
330 | if (t == NULL) { | 342 | if (t == NULL) { |
331 | char *name = kasprintf(GFP_KERNEL, "cpufreq_%s", str_governor); | 343 | char *name = kasprintf(GFP_KERNEL, "cpufreq_%s", |
344 | str_governor); | ||
332 | 345 | ||
333 | if (name) { | 346 | if (name) { |
334 | int ret; | 347 | int ret; |
@@ -361,7 +374,8 @@ extern struct sysdev_class cpu_sysdev_class; | |||
361 | 374 | ||
362 | 375 | ||
363 | /** | 376 | /** |
364 | * cpufreq_per_cpu_attr_read() / show_##file_name() - print out cpufreq information | 377 | * cpufreq_per_cpu_attr_read() / show_##file_name() - |
378 | * print out cpufreq information | ||
365 | * | 379 | * |
366 | * Write out information from cpufreq_driver->policy[cpu]; object must be | 380 | * Write out information from cpufreq_driver->policy[cpu]; object must be |
367 | * "unsigned int". | 381 | * "unsigned int". |
@@ -380,7 +394,8 @@ show_one(scaling_min_freq, min); | |||
380 | show_one(scaling_max_freq, max); | 394 | show_one(scaling_max_freq, max); |
381 | show_one(scaling_cur_freq, cur); | 395 | show_one(scaling_cur_freq, cur); |
382 | 396 | ||
383 | static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_policy *policy); | 397 | static int __cpufreq_set_policy(struct cpufreq_policy *data, |
398 | struct cpufreq_policy *policy); | ||
384 | 399 | ||
385 | /** | 400 | /** |
386 | * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access | 401 | * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access |
@@ -416,7 +431,8 @@ store_one(scaling_max_freq,max); | |||
416 | /** | 431 | /** |
417 | * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware | 432 | * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware |
418 | */ | 433 | */ |
419 | static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy, char *buf) | 434 | static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy, |
435 | char *buf) | ||
420 | { | 436 | { |
421 | unsigned int cur_freq = cpufreq_get(policy->cpu); | 437 | unsigned int cur_freq = cpufreq_get(policy->cpu); |
422 | if (!cur_freq) | 438 | if (!cur_freq) |
@@ -428,7 +444,8 @@ static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy, char *buf) | |||
428 | /** | 444 | /** |
429 | * show_scaling_governor - show the current policy for the specified CPU | 445 | * show_scaling_governor - show the current policy for the specified CPU |
430 | */ | 446 | */ |
431 | static ssize_t show_scaling_governor (struct cpufreq_policy * policy, char *buf) | 447 | static ssize_t show_scaling_governor (struct cpufreq_policy * policy, |
448 | char *buf) | ||
432 | { | 449 | { |
433 | if(policy->policy == CPUFREQ_POLICY_POWERSAVE) | 450 | if(policy->policy == CPUFREQ_POLICY_POWERSAVE) |
434 | return sprintf(buf, "powersave\n"); | 451 | return sprintf(buf, "powersave\n"); |
@@ -458,7 +475,8 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
458 | if (ret != 1) | 475 | if (ret != 1) |
459 | return -EINVAL; | 476 | return -EINVAL; |
460 | 477 | ||
461 | if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor)) | 478 | if (cpufreq_parse_governor(str_governor, &new_policy.policy, |
479 | &new_policy.governor)) | ||
462 | return -EINVAL; | 480 | return -EINVAL; |
463 | 481 | ||
464 | lock_cpu_hotplug(); | 482 | lock_cpu_hotplug(); |
@@ -474,7 +492,10 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
474 | 492 | ||
475 | unlock_cpu_hotplug(); | 493 | unlock_cpu_hotplug(); |
476 | 494 | ||
477 | return ret ? ret : count; | 495 | if (ret) |
496 | return ret; | ||
497 | else | ||
498 | return count; | ||
478 | } | 499 | } |
479 | 500 | ||
480 | /** | 501 | /** |
@@ -488,7 +509,7 @@ static ssize_t show_scaling_driver (struct cpufreq_policy * policy, char *buf) | |||
488 | /** | 509 | /** |
489 | * show_scaling_available_governors - show the available CPUfreq governors | 510 | * show_scaling_available_governors - show the available CPUfreq governors |
490 | */ | 511 | */ |
491 | static ssize_t show_scaling_available_governors (struct cpufreq_policy * policy, | 512 | static ssize_t show_scaling_available_governors (struct cpufreq_policy *policy, |
492 | char *buf) | 513 | char *buf) |
493 | { | 514 | { |
494 | ssize_t i = 0; | 515 | ssize_t i = 0; |
@@ -574,7 +595,11 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf) | |||
574 | policy = cpufreq_cpu_get(policy->cpu); | 595 | policy = cpufreq_cpu_get(policy->cpu); |
575 | if (!policy) | 596 | if (!policy) |
576 | return -EINVAL; | 597 | return -EINVAL; |
577 | ret = fattr->show ? fattr->show(policy,buf) : -EIO; | 598 | if (fattr->show) |
599 | ret = fattr->show(policy, buf); | ||
600 | else | ||
601 | ret = -EIO; | ||
602 | |||
578 | cpufreq_cpu_put(policy); | 603 | cpufreq_cpu_put(policy); |
579 | return ret; | 604 | return ret; |
580 | } | 605 | } |
@@ -588,7 +613,11 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr, | |||
588 | policy = cpufreq_cpu_get(policy->cpu); | 613 | policy = cpufreq_cpu_get(policy->cpu); |
589 | if (!policy) | 614 | if (!policy) |
590 | return -EINVAL; | 615 | return -EINVAL; |
591 | ret = fattr->store ? fattr->store(policy,buf,count) : -EIO; | 616 | if (fattr->store) |
617 | ret = fattr->store(policy, buf, count); | ||
618 | else | ||
619 | ret = -EIO; | ||
620 | |||
592 | cpufreq_cpu_put(policy); | 621 | cpufreq_cpu_put(policy); |
593 | return ret; | 622 | return ret; |
594 | } | 623 | } |
@@ -913,7 +942,8 @@ static void handle_update(struct work_struct *work) | |||
913 | * We adjust to current frequency first, and need to clean up later. So either call | 942 | * We adjust to current frequency first, and need to clean up later. So either call |
914 | * to cpufreq_update_policy() or schedule handle_update()). | 943 | * to cpufreq_update_policy() or schedule handle_update()). |
915 | */ | 944 | */ |
916 | static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigned int new_freq) | 945 | static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, |
946 | unsigned int new_freq) | ||
917 | { | 947 | { |
918 | struct cpufreq_freqs freqs; | 948 | struct cpufreq_freqs freqs; |
919 | 949 | ||
@@ -938,16 +968,16 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigne | |||
938 | unsigned int cpufreq_quick_get(unsigned int cpu) | 968 | unsigned int cpufreq_quick_get(unsigned int cpu) |
939 | { | 969 | { |
940 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); | 970 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); |
941 | unsigned int ret = 0; | 971 | unsigned int ret_freq = 0; |
942 | 972 | ||
943 | if (policy) { | 973 | if (policy) { |
944 | mutex_lock(&policy->lock); | 974 | mutex_lock(&policy->lock); |
945 | ret = policy->cur; | 975 | ret_freq = policy->cur; |
946 | mutex_unlock(&policy->lock); | 976 | mutex_unlock(&policy->lock); |
947 | cpufreq_cpu_put(policy); | 977 | cpufreq_cpu_put(policy); |
948 | } | 978 | } |
949 | 979 | ||
950 | return (ret); | 980 | return (ret_freq); |
951 | } | 981 | } |
952 | EXPORT_SYMBOL(cpufreq_quick_get); | 982 | EXPORT_SYMBOL(cpufreq_quick_get); |
953 | 983 | ||
@@ -961,7 +991,7 @@ EXPORT_SYMBOL(cpufreq_quick_get); | |||
961 | unsigned int cpufreq_get(unsigned int cpu) | 991 | unsigned int cpufreq_get(unsigned int cpu) |
962 | { | 992 | { |
963 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); | 993 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); |
964 | unsigned int ret = 0; | 994 | unsigned int ret_freq = 0; |
965 | 995 | ||
966 | if (!policy) | 996 | if (!policy) |
967 | return 0; | 997 | return 0; |
@@ -971,12 +1001,14 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
971 | 1001 | ||
972 | mutex_lock(&policy->lock); | 1002 | mutex_lock(&policy->lock); |
973 | 1003 | ||
974 | ret = cpufreq_driver->get(cpu); | 1004 | ret_freq = cpufreq_driver->get(cpu); |
975 | 1005 | ||
976 | if (ret && policy->cur && !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { | 1006 | if (ret_freq && policy->cur && |
977 | /* verify no discrepancy between actual and saved value exists */ | 1007 | !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { |
978 | if (unlikely(ret != policy->cur)) { | 1008 | /* verify no discrepancy between actual and |
979 | cpufreq_out_of_sync(cpu, policy->cur, ret); | 1009 | saved value exists */ |
1010 | if (unlikely(ret_freq != policy->cur)) { | ||
1011 | cpufreq_out_of_sync(cpu, policy->cur, ret_freq); | ||
980 | schedule_work(&policy->update); | 1012 | schedule_work(&policy->update); |
981 | } | 1013 | } |
982 | } | 1014 | } |
@@ -986,7 +1018,7 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
986 | out: | 1018 | out: |
987 | cpufreq_cpu_put(policy); | 1019 | cpufreq_cpu_put(policy); |
988 | 1020 | ||
989 | return (ret); | 1021 | return (ret_freq); |
990 | } | 1022 | } |
991 | EXPORT_SYMBOL(cpufreq_get); | 1023 | EXPORT_SYMBOL(cpufreq_get); |
992 | 1024 | ||
@@ -998,7 +1030,7 @@ EXPORT_SYMBOL(cpufreq_get); | |||
998 | static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg) | 1030 | static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg) |
999 | { | 1031 | { |
1000 | int cpu = sysdev->id; | 1032 | int cpu = sysdev->id; |
1001 | unsigned int ret = 0; | 1033 | int ret = 0; |
1002 | unsigned int cur_freq = 0; | 1034 | unsigned int cur_freq = 0; |
1003 | struct cpufreq_policy *cpu_policy; | 1035 | struct cpufreq_policy *cpu_policy; |
1004 | 1036 | ||
@@ -1080,7 +1112,7 @@ out: | |||
1080 | static int cpufreq_resume(struct sys_device * sysdev) | 1112 | static int cpufreq_resume(struct sys_device * sysdev) |
1081 | { | 1113 | { |
1082 | int cpu = sysdev->id; | 1114 | int cpu = sysdev->id; |
1083 | unsigned int ret = 0; | 1115 | int ret = 0; |
1084 | struct cpufreq_policy *cpu_policy; | 1116 | struct cpufreq_policy *cpu_policy; |
1085 | 1117 | ||
1086 | dprintk("resuming cpu %u\n", cpu); | 1118 | dprintk("resuming cpu %u\n", cpu); |
@@ -1276,22 +1308,45 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, | |||
1276 | } | 1308 | } |
1277 | EXPORT_SYMBOL_GPL(cpufreq_driver_target); | 1309 | EXPORT_SYMBOL_GPL(cpufreq_driver_target); |
1278 | 1310 | ||
1311 | int cpufreq_driver_getavg(struct cpufreq_policy *policy) | ||
1312 | { | ||
1313 | int ret = 0; | ||
1314 | |||
1315 | policy = cpufreq_cpu_get(policy->cpu); | ||
1316 | if (!policy) | ||
1317 | return -EINVAL; | ||
1318 | |||
1319 | mutex_lock(&policy->lock); | ||
1320 | |||
1321 | if (cpu_online(policy->cpu) && cpufreq_driver->getavg) | ||
1322 | ret = cpufreq_driver->getavg(policy->cpu); | ||
1323 | |||
1324 | mutex_unlock(&policy->lock); | ||
1325 | |||
1326 | cpufreq_cpu_put(policy); | ||
1327 | return ret; | ||
1328 | } | ||
1329 | EXPORT_SYMBOL_GPL(cpufreq_driver_getavg); | ||
1330 | |||
1279 | /* | 1331 | /* |
1280 | * Locking: Must be called with the lock_cpu_hotplug() lock held | 1332 | * Locking: Must be called with the lock_cpu_hotplug() lock held |
1281 | * when "event" is CPUFREQ_GOV_LIMITS | 1333 | * when "event" is CPUFREQ_GOV_LIMITS |
1282 | */ | 1334 | */ |
1283 | 1335 | ||
1284 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) | 1336 | static int __cpufreq_governor(struct cpufreq_policy *policy, |
1337 | unsigned int event) | ||
1285 | { | 1338 | { |
1286 | int ret; | 1339 | int ret; |
1287 | 1340 | ||
1288 | if (!try_module_get(policy->governor->owner)) | 1341 | if (!try_module_get(policy->governor->owner)) |
1289 | return -EINVAL; | 1342 | return -EINVAL; |
1290 | 1343 | ||
1291 | dprintk("__cpufreq_governor for CPU %u, event %u\n", policy->cpu, event); | 1344 | dprintk("__cpufreq_governor for CPU %u, event %u\n", |
1345 | policy->cpu, event); | ||
1292 | ret = policy->governor->governor(policy, event); | 1346 | ret = policy->governor->governor(policy, event); |
1293 | 1347 | ||
1294 | /* we keep one module reference alive for each CPU governed by this CPU */ | 1348 | /* we keep one module reference alive for |
1349 | each CPU governed by this CPU */ | ||
1295 | if ((event != CPUFREQ_GOV_START) || ret) | 1350 | if ((event != CPUFREQ_GOV_START) || ret) |
1296 | module_put(policy->governor->owner); | 1351 | module_put(policy->governor->owner); |
1297 | if ((event == CPUFREQ_GOV_STOP) && !ret) | 1352 | if ((event == CPUFREQ_GOV_STOP) && !ret) |
@@ -1367,9 +1422,12 @@ EXPORT_SYMBOL(cpufreq_get_policy); | |||
1367 | 1422 | ||
1368 | 1423 | ||
1369 | /* | 1424 | /* |
1425 | * data : current policy. | ||
1426 | * policy : policy to be set. | ||
1370 | * Locking: Must be called with the lock_cpu_hotplug() lock held | 1427 | * Locking: Must be called with the lock_cpu_hotplug() lock held |
1371 | */ | 1428 | */ |
1372 | static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_policy *policy) | 1429 | static int __cpufreq_set_policy(struct cpufreq_policy *data, |
1430 | struct cpufreq_policy *policy) | ||
1373 | { | 1431 | { |
1374 | int ret = 0; | 1432 | int ret = 0; |
1375 | 1433 | ||
@@ -1377,7 +1435,8 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1377 | dprintk("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu, | 1435 | dprintk("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu, |
1378 | policy->min, policy->max); | 1436 | policy->min, policy->max); |
1379 | 1437 | ||
1380 | memcpy(&policy->cpuinfo, &data->cpuinfo, sizeof(struct cpufreq_cpuinfo)); | 1438 | memcpy(&policy->cpuinfo, &data->cpuinfo, |
1439 | sizeof(struct cpufreq_cpuinfo)); | ||
1381 | 1440 | ||
1382 | if (policy->min > data->min && policy->min > policy->max) { | 1441 | if (policy->min > data->min && policy->min > policy->max) { |
1383 | ret = -EINVAL; | 1442 | ret = -EINVAL; |
@@ -1410,7 +1469,8 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1410 | data->min = policy->min; | 1469 | data->min = policy->min; |
1411 | data->max = policy->max; | 1470 | data->max = policy->max; |
1412 | 1471 | ||
1413 | dprintk("new min and max freqs are %u - %u kHz\n", data->min, data->max); | 1472 | dprintk("new min and max freqs are %u - %u kHz\n", |
1473 | data->min, data->max); | ||
1414 | 1474 | ||
1415 | if (cpufreq_driver->setpolicy) { | 1475 | if (cpufreq_driver->setpolicy) { |
1416 | data->policy = policy->policy; | 1476 | data->policy = policy->policy; |
@@ -1431,10 +1491,12 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1431 | data->governor = policy->governor; | 1491 | data->governor = policy->governor; |
1432 | if (__cpufreq_governor(data, CPUFREQ_GOV_START)) { | 1492 | if (__cpufreq_governor(data, CPUFREQ_GOV_START)) { |
1433 | /* new governor failed, so re-start old one */ | 1493 | /* new governor failed, so re-start old one */ |
1434 | dprintk("starting governor %s failed\n", data->governor->name); | 1494 | dprintk("starting governor %s failed\n", |
1495 | data->governor->name); | ||
1435 | if (old_gov) { | 1496 | if (old_gov) { |
1436 | data->governor = old_gov; | 1497 | data->governor = old_gov; |
1437 | __cpufreq_governor(data, CPUFREQ_GOV_START); | 1498 | __cpufreq_governor(data, |
1499 | CPUFREQ_GOV_START); | ||
1438 | } | 1500 | } |
1439 | ret = -EINVAL; | 1501 | ret = -EINVAL; |
1440 | goto error_out; | 1502 | goto error_out; |
@@ -1524,7 +1586,8 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1524 | data->cur = policy.cur; | 1586 | data->cur = policy.cur; |
1525 | } else { | 1587 | } else { |
1526 | if (data->cur != policy.cur) | 1588 | if (data->cur != policy.cur) |
1527 | cpufreq_out_of_sync(cpu, data->cur, policy.cur); | 1589 | cpufreq_out_of_sync(cpu, data->cur, |
1590 | policy.cur); | ||
1528 | } | 1591 | } |
1529 | } | 1592 | } |
1530 | 1593 | ||
@@ -1626,8 +1689,10 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
1626 | 1689 | ||
1627 | /* if all ->init() calls failed, unregister */ | 1690 | /* if all ->init() calls failed, unregister */ |
1628 | if (ret) { | 1691 | if (ret) { |
1629 | dprintk("no CPU initialized for driver %s\n", driver_data->name); | 1692 | dprintk("no CPU initialized for driver %s\n", |
1630 | sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); | 1693 | driver_data->name); |
1694 | sysdev_driver_unregister(&cpu_sysdev_class, | ||
1695 | &cpufreq_sysdev_driver); | ||
1631 | 1696 | ||
1632 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | 1697 | spin_lock_irqsave(&cpufreq_driver_lock, flags); |
1633 | cpufreq_driver = NULL; | 1698 | cpufreq_driver = NULL; |