aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/cpu-freq/index.txt2
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c10
-rw-r--r--drivers/cpufreq/Kconfig2
-rw-r--r--drivers/cpufreq/cpufreq.c25
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c6
5 files changed, 27 insertions, 18 deletions
diff --git a/Documentation/cpu-freq/index.txt b/Documentation/cpu-freq/index.txt
index 5009805f937..ffdb5323df3 100644
--- a/Documentation/cpu-freq/index.txt
+++ b/Documentation/cpu-freq/index.txt
@@ -53,4 +53,4 @@ the CPUFreq Mailing list:
53* http://lists.linux.org.uk/mailman/listinfo/cpufreq 53* http://lists.linux.org.uk/mailman/listinfo/cpufreq
54 54
55Clock and voltage scaling for the SA-1100: 55Clock and voltage scaling for the SA-1100:
56* http://www.lart.tudelft.nl/projects/scaling 56* http://www.lartmaker.nl/projects/scaling
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
index 7c0e160a214..71fffa17442 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -905,14 +905,17 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
905{ 905{
906 cpumask_t oldmask = CPU_MASK_ALL; 906 cpumask_t oldmask = CPU_MASK_ALL;
907 struct powernow_k8_data *data = powernow_data[pol->cpu]; 907 struct powernow_k8_data *data = powernow_data[pol->cpu];
908 u32 checkfid = data->currfid; 908 u32 checkfid;
909 u32 checkvid = data->currvid; 909 u32 checkvid;
910 unsigned int newstate; 910 unsigned int newstate;
911 int ret = -EIO; 911 int ret = -EIO;
912 912
913 if (!data) 913 if (!data)
914 return -EINVAL; 914 return -EINVAL;
915 915
916 checkfid = data->currfid;
917 checkvid = data->currvid;
918
916 /* only run on specific CPU from here on */ 919 /* only run on specific CPU from here on */
917 oldmask = current->cpus_allowed; 920 oldmask = current->cpus_allowed;
918 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); 921 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
@@ -1109,9 +1112,6 @@ static unsigned int powernowk8_get (unsigned int cpu)
1109 if (!data) 1112 if (!data)
1110 return -EINVAL; 1113 return -EINVAL;
1111 1114
1112 if (!data)
1113 return -EINVAL;
1114
1115 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 1115 set_cpus_allowed(current, cpumask_of_cpu(cpu));
1116 if (smp_processor_id() != cpu) { 1116 if (smp_processor_id() != cpu) {
1117 printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu); 1117 printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu);
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index 60c9be99c6d..2cc71b66231 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -99,7 +99,7 @@ config CPU_FREQ_GOV_USERSPACE
99 Enable this cpufreq governor when you either want to set the 99 Enable this cpufreq governor when you either want to set the
100 CPU frequency manually or when an userspace program shall 100 CPU frequency manually or when an userspace program shall
101 be able to set the CPU dynamically, like on LART 101 be able to set the CPU dynamically, like on LART
102 <http://www.lart.tudelft.nl/> 102 <http://www.lartmaker.nl/>.
103 103
104 For details, take a look at <file:Documentation/cpu-freq/>. 104 For details, take a look at <file:Documentation/cpu-freq/>.
105 105
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 9b6ae7dc8b8..9759d05b197 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}
322EXPORT_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);
346show_one(scaling_max_freq, max); 345show_one(scaling_max_freq, max);
347show_one(scaling_cur_freq, cur); 346show_one(scaling_cur_freq, cur);
348 347
348static 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
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 037f6bf4543..e07a35487bd 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -176,8 +176,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused,
176 ret = sscanf (buf, "%u", &input); 176 ret = sscanf (buf, "%u", &input);
177 177
178 mutex_lock(&dbs_mutex); 178 mutex_lock(&dbs_mutex);
179 if (ret != 1 || input > 100 || input < 0 || 179 if (ret != 1 || input > 100 || input <= dbs_tuners_ins.down_threshold) {
180 input <= dbs_tuners_ins.down_threshold) {
181 mutex_unlock(&dbs_mutex); 180 mutex_unlock(&dbs_mutex);
182 return -EINVAL; 181 return -EINVAL;
183 } 182 }
@@ -196,8 +195,7 @@ static ssize_t store_down_threshold(struct cpufreq_policy *unused,
196 ret = sscanf (buf, "%u", &input); 195 ret = sscanf (buf, "%u", &input);
197 196
198 mutex_lock(&dbs_mutex); 197 mutex_lock(&dbs_mutex);
199 if (ret != 1 || input > 100 || input < 0 || 198 if (ret != 1 || input > 100 || input >= dbs_tuners_ins.up_threshold) {
200 input >= dbs_tuners_ins.up_threshold) {
201 mutex_unlock(&dbs_mutex); 199 mutex_unlock(&dbs_mutex);
202 return -EINVAL; 200 return -EINVAL;
203 } 201 }