diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 9b6ae7dc8b8a..29b2fa5534ae 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -319,7 +319,6 @@ out: | |||
319 | } | 319 | } |
320 | return -EINVAL; | 320 | return -EINVAL; |
321 | } | 321 | } |
322 | EXPORT_SYMBOL_GPL(cpufreq_parse_governor); | ||
323 | 322 | ||
324 | 323 | ||
325 | /* drivers/base/cpu.c */ | 324 | /* drivers/base/cpu.c */ |
@@ -346,6 +345,8 @@ show_one(scaling_min_freq, min); | |||
346 | show_one(scaling_max_freq, max); | 345 | show_one(scaling_max_freq, max); |
347 | show_one(scaling_cur_freq, cur); | 346 | show_one(scaling_cur_freq, cur); |
348 | 347 | ||
348 | static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_policy *policy); | ||
349 | |||
349 | /** | 350 | /** |
350 | * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access | 351 | * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access |
351 | */ | 352 | */ |
@@ -364,7 +365,10 @@ static ssize_t store_##file_name \ | |||
364 | if (ret != 1) \ | 365 | if (ret != 1) \ |
365 | return -EINVAL; \ | 366 | return -EINVAL; \ |
366 | \ | 367 | \ |
367 | ret = cpufreq_set_policy(&new_policy); \ | 368 | mutex_lock(&policy->lock); \ |
369 | ret = __cpufreq_set_policy(policy, &new_policy); \ | ||
370 | policy->user_policy.object = policy->object; \ | ||
371 | mutex_unlock(&policy->lock); \ | ||
368 | \ | 372 | \ |
369 | return ret ? ret : count; \ | 373 | return ret ? ret : count; \ |
370 | } | 374 | } |
@@ -420,7 +424,15 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
420 | if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor)) | 424 | if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor)) |
421 | return -EINVAL; | 425 | return -EINVAL; |
422 | 426 | ||
423 | ret = cpufreq_set_policy(&new_policy); | 427 | /* Do not use cpufreq_set_policy here or the user_policy.max |
428 | will be wrongly overridden */ | ||
429 | mutex_lock(&policy->lock); | ||
430 | ret = __cpufreq_set_policy(policy, &new_policy); | ||
431 | |||
432 | policy->user_policy.policy = policy->policy; | ||
433 | policy->user_policy.governor = policy->governor; | ||
434 | mutex_unlock(&policy->lock); | ||
435 | |||
424 | return ret ? ret : count; | 436 | return ret ? ret : count; |
425 | } | 437 | } |
426 | 438 | ||
@@ -685,7 +697,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
685 | if (!cpu_online(j)) | 697 | if (!cpu_online(j)) |
686 | continue; | 698 | continue; |
687 | 699 | ||
688 | dprintk("CPU already managed, adding link\n"); | 700 | dprintk("CPU %u already managed, adding link\n", j); |
689 | cpufreq_cpu_get(cpu); | 701 | cpufreq_cpu_get(cpu); |
690 | cpu_sys_dev = get_cpu_sysdev(j); | 702 | cpu_sys_dev = get_cpu_sysdev(j); |
691 | sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, | 703 | sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, |
@@ -695,9 +707,8 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
695 | policy->governor = NULL; /* to assure that the starting sequence is | 707 | policy->governor = NULL; /* to assure that the starting sequence is |
696 | * run in cpufreq_set_policy */ | 708 | * run in cpufreq_set_policy */ |
697 | mutex_unlock(&policy->lock); | 709 | mutex_unlock(&policy->lock); |
698 | 710 | ||
699 | /* set default policy */ | 711 | /* set default policy */ |
700 | |||
701 | ret = cpufreq_set_policy(&new_policy); | 712 | ret = cpufreq_set_policy(&new_policy); |
702 | if (ret) { | 713 | if (ret) { |
703 | dprintk("setting policy failed\n"); | 714 | dprintk("setting policy failed\n"); |
@@ -707,7 +718,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
707 | module_put(cpufreq_driver->owner); | 718 | module_put(cpufreq_driver->owner); |
708 | dprintk("initialization complete\n"); | 719 | dprintk("initialization complete\n"); |
709 | cpufreq_debug_enable_ratelimit(); | 720 | cpufreq_debug_enable_ratelimit(); |
710 | 721 | ||
711 | return 0; | 722 | return 0; |
712 | 723 | ||
713 | 724 | ||
@@ -1486,7 +1497,7 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1486 | } | 1497 | } |
1487 | EXPORT_SYMBOL(cpufreq_update_policy); | 1498 | EXPORT_SYMBOL(cpufreq_update_policy); |
1488 | 1499 | ||
1489 | static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb, | 1500 | static int cpufreq_cpu_callback(struct notifier_block *nfb, |
1490 | unsigned long action, void *hcpu) | 1501 | unsigned long action, void *hcpu) |
1491 | { | 1502 | { |
1492 | unsigned int cpu = (unsigned long)hcpu; | 1503 | unsigned int cpu = (unsigned long)hcpu; |