diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 136 |
1 files changed, 91 insertions, 45 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 56c433e64d58..0c18ac2fe7c2 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 |
@@ -41,7 +42,8 @@ static struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS]; | |||
41 | static DEFINE_SPINLOCK(cpufreq_driver_lock); | 42 | static DEFINE_SPINLOCK(cpufreq_driver_lock); |
42 | 43 | ||
43 | /* internal prototypes */ | 44 | /* internal prototypes */ |
44 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); | 45 | static int __cpufreq_governor(struct cpufreq_policy *policy, |
46 | unsigned int event); | ||
45 | static void handle_update(void *data); | 47 | static void handle_update(void *data); |
46 | 48 | ||
47 | /** | 49 | /** |
@@ -151,7 +153,8 @@ static void cpufreq_debug_disable_ratelimit(void) | |||
151 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); | 153 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); |
152 | } | 154 | } |
153 | 155 | ||
154 | void cpufreq_debug_printk(unsigned int type, const char *prefix, const char *fmt, ...) | 156 | void cpufreq_debug_printk(unsigned int type, const char *prefix, |
157 | const char *fmt, ...) | ||
155 | { | 158 | { |
156 | char s[256]; | 159 | char s[256]; |
157 | va_list args; | 160 | va_list args; |
@@ -161,7 +164,8 @@ void cpufreq_debug_printk(unsigned int type, const char *prefix, const char *fmt | |||
161 | WARN_ON(!prefix); | 164 | WARN_ON(!prefix); |
162 | if (type & debug) { | 165 | if (type & debug) { |
163 | spin_lock_irqsave(&disable_ratelimit_lock, flags); | 166 | spin_lock_irqsave(&disable_ratelimit_lock, flags); |
164 | if (!disable_ratelimit && debug_ratelimit && !printk_ratelimit()) { | 167 | if (!disable_ratelimit && debug_ratelimit |
168 | && !printk_ratelimit()) { | ||
165 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); | 169 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); |
166 | return; | 170 | return; |
167 | } | 171 | } |
@@ -182,10 +186,12 @@ EXPORT_SYMBOL(cpufreq_debug_printk); | |||
182 | 186 | ||
183 | 187 | ||
184 | module_param(debug, uint, 0644); | 188 | 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."); | 189 | MODULE_PARM_DESC(debug, "CPUfreq debugging: add 1 to debug core," |
190 | " 2 to debug drivers, and 4 to debug governors."); | ||
186 | 191 | ||
187 | module_param(debug_ratelimit, uint, 0644); | 192 | module_param(debug_ratelimit, uint, 0644); |
188 | MODULE_PARM_DESC(debug_ratelimit, "CPUfreq debugging: set to 0 to disable ratelimiting."); | 193 | MODULE_PARM_DESC(debug_ratelimit, "CPUfreq debugging:" |
194 | " set to 0 to disable ratelimiting."); | ||
189 | 195 | ||
190 | #else /* !CONFIG_CPU_FREQ_DEBUG */ | 196 | #else /* !CONFIG_CPU_FREQ_DEBUG */ |
191 | 197 | ||
@@ -219,17 +225,23 @@ static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) | |||
219 | if (!l_p_j_ref_freq) { | 225 | if (!l_p_j_ref_freq) { |
220 | l_p_j_ref = loops_per_jiffy; | 226 | l_p_j_ref = loops_per_jiffy; |
221 | l_p_j_ref_freq = ci->old; | 227 | 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); | 228 | dprintk("saving %lu as reference value for loops_per_jiffy;" |
229 | "freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq); | ||
223 | } | 230 | } |
224 | if ((val == CPUFREQ_PRECHANGE && ci->old < ci->new) || | 231 | if ((val == CPUFREQ_PRECHANGE && ci->old < ci->new) || |
225 | (val == CPUFREQ_POSTCHANGE && ci->old > ci->new) || | 232 | (val == CPUFREQ_POSTCHANGE && ci->old > ci->new) || |
226 | (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { | 233 | (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { |
227 | loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, ci->new); | 234 | 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); | 235 | ci->new); |
236 | dprintk("scaling loops_per_jiffy to %lu" | ||
237 | "for frequency %u kHz\n", loops_per_jiffy, ci->new); | ||
229 | } | 238 | } |
230 | } | 239 | } |
231 | #else | 240 | #else |
232 | static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) { return; } | 241 | static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) |
242 | { | ||
243 | return; | ||
244 | } | ||
233 | #endif | 245 | #endif |
234 | 246 | ||
235 | 247 | ||
@@ -316,7 +328,8 @@ static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, | |||
316 | if (!strnicmp(str_governor, "performance", CPUFREQ_NAME_LEN)) { | 328 | if (!strnicmp(str_governor, "performance", CPUFREQ_NAME_LEN)) { |
317 | *policy = CPUFREQ_POLICY_PERFORMANCE; | 329 | *policy = CPUFREQ_POLICY_PERFORMANCE; |
318 | err = 0; | 330 | err = 0; |
319 | } else if (!strnicmp(str_governor, "powersave", CPUFREQ_NAME_LEN)) { | 331 | } else if (!strnicmp(str_governor, "powersave", |
332 | CPUFREQ_NAME_LEN)) { | ||
320 | *policy = CPUFREQ_POLICY_POWERSAVE; | 333 | *policy = CPUFREQ_POLICY_POWERSAVE; |
321 | err = 0; | 334 | err = 0; |
322 | } | 335 | } |
@@ -328,7 +341,8 @@ static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, | |||
328 | t = __find_governor(str_governor); | 341 | t = __find_governor(str_governor); |
329 | 342 | ||
330 | if (t == NULL) { | 343 | if (t == NULL) { |
331 | char *name = kasprintf(GFP_KERNEL, "cpufreq_%s", str_governor); | 344 | char *name = kasprintf(GFP_KERNEL, "cpufreq_%s", |
345 | str_governor); | ||
332 | 346 | ||
333 | if (name) { | 347 | if (name) { |
334 | int ret; | 348 | int ret; |
@@ -361,7 +375,8 @@ extern struct sysdev_class cpu_sysdev_class; | |||
361 | 375 | ||
362 | 376 | ||
363 | /** | 377 | /** |
364 | * cpufreq_per_cpu_attr_read() / show_##file_name() - print out cpufreq information | 378 | * cpufreq_per_cpu_attr_read() / show_##file_name() - |
379 | * print out cpufreq information | ||
365 | * | 380 | * |
366 | * Write out information from cpufreq_driver->policy[cpu]; object must be | 381 | * Write out information from cpufreq_driver->policy[cpu]; object must be |
367 | * "unsigned int". | 382 | * "unsigned int". |
@@ -380,7 +395,8 @@ show_one(scaling_min_freq, min); | |||
380 | show_one(scaling_max_freq, max); | 395 | show_one(scaling_max_freq, max); |
381 | show_one(scaling_cur_freq, cur); | 396 | show_one(scaling_cur_freq, cur); |
382 | 397 | ||
383 | static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_policy *policy); | 398 | static int __cpufreq_set_policy(struct cpufreq_policy *data, |
399 | struct cpufreq_policy *policy); | ||
384 | 400 | ||
385 | /** | 401 | /** |
386 | * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access | 402 | * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access |
@@ -416,7 +432,8 @@ store_one(scaling_max_freq,max); | |||
416 | /** | 432 | /** |
417 | * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware | 433 | * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware |
418 | */ | 434 | */ |
419 | static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy, char *buf) | 435 | static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy, |
436 | char *buf) | ||
420 | { | 437 | { |
421 | unsigned int cur_freq = cpufreq_get(policy->cpu); | 438 | unsigned int cur_freq = cpufreq_get(policy->cpu); |
422 | if (!cur_freq) | 439 | if (!cur_freq) |
@@ -428,7 +445,8 @@ static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy, char *buf) | |||
428 | /** | 445 | /** |
429 | * show_scaling_governor - show the current policy for the specified CPU | 446 | * show_scaling_governor - show the current policy for the specified CPU |
430 | */ | 447 | */ |
431 | static ssize_t show_scaling_governor (struct cpufreq_policy * policy, char *buf) | 448 | static ssize_t show_scaling_governor (struct cpufreq_policy * policy, |
449 | char *buf) | ||
432 | { | 450 | { |
433 | if(policy->policy == CPUFREQ_POLICY_POWERSAVE) | 451 | if(policy->policy == CPUFREQ_POLICY_POWERSAVE) |
434 | return sprintf(buf, "powersave\n"); | 452 | return sprintf(buf, "powersave\n"); |
@@ -458,7 +476,8 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
458 | if (ret != 1) | 476 | if (ret != 1) |
459 | return -EINVAL; | 477 | return -EINVAL; |
460 | 478 | ||
461 | if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor)) | 479 | if (cpufreq_parse_governor(str_governor, &new_policy.policy, |
480 | &new_policy.governor)) | ||
462 | return -EINVAL; | 481 | return -EINVAL; |
463 | 482 | ||
464 | lock_cpu_hotplug(); | 483 | lock_cpu_hotplug(); |
@@ -474,7 +493,10 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
474 | 493 | ||
475 | unlock_cpu_hotplug(); | 494 | unlock_cpu_hotplug(); |
476 | 495 | ||
477 | return ret ? ret : count; | 496 | if (ret) |
497 | return ret; | ||
498 | else | ||
499 | return count; | ||
478 | } | 500 | } |
479 | 501 | ||
480 | /** | 502 | /** |
@@ -488,7 +510,7 @@ static ssize_t show_scaling_driver (struct cpufreq_policy * policy, char *buf) | |||
488 | /** | 510 | /** |
489 | * show_scaling_available_governors - show the available CPUfreq governors | 511 | * show_scaling_available_governors - show the available CPUfreq governors |
490 | */ | 512 | */ |
491 | static ssize_t show_scaling_available_governors (struct cpufreq_policy * policy, | 513 | static ssize_t show_scaling_available_governors (struct cpufreq_policy *policy, |
492 | char *buf) | 514 | char *buf) |
493 | { | 515 | { |
494 | ssize_t i = 0; | 516 | ssize_t i = 0; |
@@ -574,7 +596,11 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf) | |||
574 | policy = cpufreq_cpu_get(policy->cpu); | 596 | policy = cpufreq_cpu_get(policy->cpu); |
575 | if (!policy) | 597 | if (!policy) |
576 | return -EINVAL; | 598 | return -EINVAL; |
577 | ret = fattr->show ? fattr->show(policy,buf) : -EIO; | 599 | if (fattr->show) |
600 | ret = fattr->show(policy, buf); | ||
601 | else | ||
602 | ret = -EIO; | ||
603 | |||
578 | cpufreq_cpu_put(policy); | 604 | cpufreq_cpu_put(policy); |
579 | return ret; | 605 | return ret; |
580 | } | 606 | } |
@@ -588,7 +614,11 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr, | |||
588 | policy = cpufreq_cpu_get(policy->cpu); | 614 | policy = cpufreq_cpu_get(policy->cpu); |
589 | if (!policy) | 615 | if (!policy) |
590 | return -EINVAL; | 616 | return -EINVAL; |
591 | ret = fattr->store ? fattr->store(policy,buf,count) : -EIO; | 617 | if (fattr->store) |
618 | ret = fattr->store(policy, buf, count); | ||
619 | else | ||
620 | ret = -EIO; | ||
621 | |||
592 | cpufreq_cpu_put(policy); | 622 | cpufreq_cpu_put(policy); |
593 | return ret; | 623 | return ret; |
594 | } | 624 | } |
@@ -911,7 +941,8 @@ static void handle_update(void *data) | |||
911 | * We adjust to current frequency first, and need to clean up later. So either call | 941 | * We adjust to current frequency first, and need to clean up later. So either call |
912 | * to cpufreq_update_policy() or schedule handle_update()). | 942 | * to cpufreq_update_policy() or schedule handle_update()). |
913 | */ | 943 | */ |
914 | static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigned int new_freq) | 944 | static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, |
945 | unsigned int new_freq) | ||
915 | { | 946 | { |
916 | struct cpufreq_freqs freqs; | 947 | struct cpufreq_freqs freqs; |
917 | 948 | ||
@@ -936,16 +967,16 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigne | |||
936 | unsigned int cpufreq_quick_get(unsigned int cpu) | 967 | unsigned int cpufreq_quick_get(unsigned int cpu) |
937 | { | 968 | { |
938 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); | 969 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); |
939 | unsigned int ret = 0; | 970 | unsigned int ret_freq = 0; |
940 | 971 | ||
941 | if (policy) { | 972 | if (policy) { |
942 | mutex_lock(&policy->lock); | 973 | mutex_lock(&policy->lock); |
943 | ret = policy->cur; | 974 | ret_freq = policy->cur; |
944 | mutex_unlock(&policy->lock); | 975 | mutex_unlock(&policy->lock); |
945 | cpufreq_cpu_put(policy); | 976 | cpufreq_cpu_put(policy); |
946 | } | 977 | } |
947 | 978 | ||
948 | return (ret); | 979 | return (ret_freq); |
949 | } | 980 | } |
950 | EXPORT_SYMBOL(cpufreq_quick_get); | 981 | EXPORT_SYMBOL(cpufreq_quick_get); |
951 | 982 | ||
@@ -959,7 +990,7 @@ EXPORT_SYMBOL(cpufreq_quick_get); | |||
959 | unsigned int cpufreq_get(unsigned int cpu) | 990 | unsigned int cpufreq_get(unsigned int cpu) |
960 | { | 991 | { |
961 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); | 992 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); |
962 | unsigned int ret = 0; | 993 | unsigned int ret_freq = 0; |
963 | 994 | ||
964 | if (!policy) | 995 | if (!policy) |
965 | return 0; | 996 | return 0; |
@@ -969,12 +1000,14 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
969 | 1000 | ||
970 | mutex_lock(&policy->lock); | 1001 | mutex_lock(&policy->lock); |
971 | 1002 | ||
972 | ret = cpufreq_driver->get(cpu); | 1003 | ret_freq = cpufreq_driver->get(cpu); |
973 | 1004 | ||
974 | if (ret && policy->cur && !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { | 1005 | if (ret_freq && policy->cur && |
975 | /* verify no discrepancy between actual and saved value exists */ | 1006 | !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { |
976 | if (unlikely(ret != policy->cur)) { | 1007 | /* verify no discrepancy between actual and |
977 | cpufreq_out_of_sync(cpu, policy->cur, ret); | 1008 | saved value exists */ |
1009 | if (unlikely(ret_freq != policy->cur)) { | ||
1010 | cpufreq_out_of_sync(cpu, policy->cur, ret_freq); | ||
978 | schedule_work(&policy->update); | 1011 | schedule_work(&policy->update); |
979 | } | 1012 | } |
980 | } | 1013 | } |
@@ -984,7 +1017,7 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
984 | out: | 1017 | out: |
985 | cpufreq_cpu_put(policy); | 1018 | cpufreq_cpu_put(policy); |
986 | 1019 | ||
987 | return (ret); | 1020 | return (ret_freq); |
988 | } | 1021 | } |
989 | EXPORT_SYMBOL(cpufreq_get); | 1022 | EXPORT_SYMBOL(cpufreq_get); |
990 | 1023 | ||
@@ -996,7 +1029,7 @@ EXPORT_SYMBOL(cpufreq_get); | |||
996 | static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg) | 1029 | static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg) |
997 | { | 1030 | { |
998 | int cpu = sysdev->id; | 1031 | int cpu = sysdev->id; |
999 | unsigned int ret = 0; | 1032 | int ret = 0; |
1000 | unsigned int cur_freq = 0; | 1033 | unsigned int cur_freq = 0; |
1001 | struct cpufreq_policy *cpu_policy; | 1034 | struct cpufreq_policy *cpu_policy; |
1002 | 1035 | ||
@@ -1078,7 +1111,7 @@ out: | |||
1078 | static int cpufreq_resume(struct sys_device * sysdev) | 1111 | static int cpufreq_resume(struct sys_device * sysdev) |
1079 | { | 1112 | { |
1080 | int cpu = sysdev->id; | 1113 | int cpu = sysdev->id; |
1081 | unsigned int ret = 0; | 1114 | int ret = 0; |
1082 | struct cpufreq_policy *cpu_policy; | 1115 | struct cpufreq_policy *cpu_policy; |
1083 | 1116 | ||
1084 | dprintk("resuming cpu %u\n", cpu); | 1117 | dprintk("resuming cpu %u\n", cpu); |
@@ -1299,17 +1332,20 @@ EXPORT_SYMBOL_GPL(cpufreq_driver_getavg); | |||
1299 | * when "event" is CPUFREQ_GOV_LIMITS | 1332 | * when "event" is CPUFREQ_GOV_LIMITS |
1300 | */ | 1333 | */ |
1301 | 1334 | ||
1302 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) | 1335 | static int __cpufreq_governor(struct cpufreq_policy *policy, |
1336 | unsigned int event) | ||
1303 | { | 1337 | { |
1304 | int ret; | 1338 | int ret; |
1305 | 1339 | ||
1306 | if (!try_module_get(policy->governor->owner)) | 1340 | if (!try_module_get(policy->governor->owner)) |
1307 | return -EINVAL; | 1341 | return -EINVAL; |
1308 | 1342 | ||
1309 | dprintk("__cpufreq_governor for CPU %u, event %u\n", policy->cpu, event); | 1343 | dprintk("__cpufreq_governor for CPU %u, event %u\n", |
1344 | policy->cpu, event); | ||
1310 | ret = policy->governor->governor(policy, event); | 1345 | ret = policy->governor->governor(policy, event); |
1311 | 1346 | ||
1312 | /* we keep one module reference alive for each CPU governed by this CPU */ | 1347 | /* we keep one module reference alive for |
1348 | each CPU governed by this CPU */ | ||
1313 | if ((event != CPUFREQ_GOV_START) || ret) | 1349 | if ((event != CPUFREQ_GOV_START) || ret) |
1314 | module_put(policy->governor->owner); | 1350 | module_put(policy->governor->owner); |
1315 | if ((event == CPUFREQ_GOV_STOP) && !ret) | 1351 | if ((event == CPUFREQ_GOV_STOP) && !ret) |
@@ -1385,9 +1421,12 @@ EXPORT_SYMBOL(cpufreq_get_policy); | |||
1385 | 1421 | ||
1386 | 1422 | ||
1387 | /* | 1423 | /* |
1424 | * data : current policy. | ||
1425 | * policy : policy to be set. | ||
1388 | * Locking: Must be called with the lock_cpu_hotplug() lock held | 1426 | * Locking: Must be called with the lock_cpu_hotplug() lock held |
1389 | */ | 1427 | */ |
1390 | static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_policy *policy) | 1428 | static int __cpufreq_set_policy(struct cpufreq_policy *data, |
1429 | struct cpufreq_policy *policy) | ||
1391 | { | 1430 | { |
1392 | int ret = 0; | 1431 | int ret = 0; |
1393 | 1432 | ||
@@ -1395,7 +1434,8 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1395 | dprintk("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu, | 1434 | dprintk("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu, |
1396 | policy->min, policy->max); | 1435 | policy->min, policy->max); |
1397 | 1436 | ||
1398 | memcpy(&policy->cpuinfo, &data->cpuinfo, sizeof(struct cpufreq_cpuinfo)); | 1437 | memcpy(&policy->cpuinfo, &data->cpuinfo, |
1438 | sizeof(struct cpufreq_cpuinfo)); | ||
1399 | 1439 | ||
1400 | if (policy->min > data->min && policy->min > policy->max) { | 1440 | if (policy->min > data->min && policy->min > policy->max) { |
1401 | ret = -EINVAL; | 1441 | ret = -EINVAL; |
@@ -1428,7 +1468,8 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1428 | data->min = policy->min; | 1468 | data->min = policy->min; |
1429 | data->max = policy->max; | 1469 | data->max = policy->max; |
1430 | 1470 | ||
1431 | dprintk("new min and max freqs are %u - %u kHz\n", data->min, data->max); | 1471 | dprintk("new min and max freqs are %u - %u kHz\n", |
1472 | data->min, data->max); | ||
1432 | 1473 | ||
1433 | if (cpufreq_driver->setpolicy) { | 1474 | if (cpufreq_driver->setpolicy) { |
1434 | data->policy = policy->policy; | 1475 | data->policy = policy->policy; |
@@ -1449,10 +1490,12 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1449 | data->governor = policy->governor; | 1490 | data->governor = policy->governor; |
1450 | if (__cpufreq_governor(data, CPUFREQ_GOV_START)) { | 1491 | if (__cpufreq_governor(data, CPUFREQ_GOV_START)) { |
1451 | /* new governor failed, so re-start old one */ | 1492 | /* new governor failed, so re-start old one */ |
1452 | dprintk("starting governor %s failed\n", data->governor->name); | 1493 | dprintk("starting governor %s failed\n", |
1494 | data->governor->name); | ||
1453 | if (old_gov) { | 1495 | if (old_gov) { |
1454 | data->governor = old_gov; | 1496 | data->governor = old_gov; |
1455 | __cpufreq_governor(data, CPUFREQ_GOV_START); | 1497 | __cpufreq_governor(data, |
1498 | CPUFREQ_GOV_START); | ||
1456 | } | 1499 | } |
1457 | ret = -EINVAL; | 1500 | ret = -EINVAL; |
1458 | goto error_out; | 1501 | goto error_out; |
@@ -1542,7 +1585,8 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1542 | data->cur = policy.cur; | 1585 | data->cur = policy.cur; |
1543 | } else { | 1586 | } else { |
1544 | if (data->cur != policy.cur) | 1587 | if (data->cur != policy.cur) |
1545 | cpufreq_out_of_sync(cpu, data->cur, policy.cur); | 1588 | cpufreq_out_of_sync(cpu, data->cur, |
1589 | policy.cur); | ||
1546 | } | 1590 | } |
1547 | } | 1591 | } |
1548 | 1592 | ||
@@ -1646,8 +1690,10 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
1646 | 1690 | ||
1647 | /* if all ->init() calls failed, unregister */ | 1691 | /* if all ->init() calls failed, unregister */ |
1648 | if (ret) { | 1692 | if (ret) { |
1649 | dprintk("no CPU initialized for driver %s\n", driver_data->name); | 1693 | dprintk("no CPU initialized for driver %s\n", |
1650 | sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); | 1694 | driver_data->name); |
1695 | sysdev_driver_unregister(&cpu_sysdev_class, | ||
1696 | &cpufreq_sysdev_driver); | ||
1651 | 1697 | ||
1652 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | 1698 | spin_lock_irqsave(&cpufreq_driver_lock, flags); |
1653 | cpufreq_driver = NULL; | 1699 | cpufreq_driver = NULL; |