Commit c63fdeee authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq

* master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq:
  [CPUFREQ] powernow-k8.c: fix a check-after-use
  [CPUFREQ] Remove duplicate check in powernow-k8
  [CPUFREQ] drivers/cpufreq/cpufreq.c: static functions mustn't be exported
  [CPUFREQ] If max_freq got reduced (e.g. by _PPC) a write to sysfs scaling_governor let cpufreq core stuck at low max_freq for ever
  [CPUFREQ] x86_64: Proper null pointer check in powernow_k8_get
  [CPUFREQ] x86_64: Revert earlier powernow-k8 change
  [CPUFREQ] Update LART site URL
  [CPUFREQ] Remove pointless check in conservative governor.
  [CPUFREQ] trailing whitespace removal de-jour.
  [CPUFREQ] extra debugging in cpufreq_add_dev()
parents c63f774c 9180053c
...@@ -53,4 +53,4 @@ the CPUFreq Mailing list: ...@@ -53,4 +53,4 @@ the CPUFreq Mailing list:
* http://lists.linux.org.uk/mailman/listinfo/cpufreq * http://lists.linux.org.uk/mailman/listinfo/cpufreq
Clock and voltage scaling for the SA-1100: Clock and voltage scaling for the SA-1100:
* http://www.lart.tudelft.nl/projects/scaling * http://www.lartmaker.nl/projects/scaling
...@@ -905,14 +905,17 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi ...@@ -905,14 +905,17 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
{ {
cpumask_t oldmask = CPU_MASK_ALL; cpumask_t oldmask = CPU_MASK_ALL;
struct powernow_k8_data *data = powernow_data[pol->cpu]; struct powernow_k8_data *data = powernow_data[pol->cpu];
u32 checkfid = data->currfid; u32 checkfid;
u32 checkvid = data->currvid; u32 checkvid;
unsigned int newstate; unsigned int newstate;
int ret = -EIO; int ret = -EIO;
if (!data) if (!data)
return -EINVAL; return -EINVAL;
checkfid = data->currfid;
checkvid = data->currvid;
/* only run on specific CPU from here on */ /* only run on specific CPU from here on */
oldmask = current->cpus_allowed; oldmask = current->cpus_allowed;
set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
...@@ -1106,9 +1109,6 @@ static unsigned int powernowk8_get (unsigned int cpu) ...@@ -1106,9 +1109,6 @@ static unsigned int powernowk8_get (unsigned int cpu)
data = powernow_data[first_cpu(cpu_core_map[cpu])]; data = powernow_data[first_cpu(cpu_core_map[cpu])];
if (!data)
return -EINVAL;
if (!data) if (!data)
return -EINVAL; return -EINVAL;
......
...@@ -99,7 +99,7 @@ config CPU_FREQ_GOV_USERSPACE ...@@ -99,7 +99,7 @@ config CPU_FREQ_GOV_USERSPACE
Enable this cpufreq governor when you either want to set the Enable this cpufreq governor when you either want to set the
CPU frequency manually or when an userspace program shall CPU frequency manually or when an userspace program shall
be able to set the CPU dynamically, like on LART be able to set the CPU dynamically, like on LART
<http://www.lart.tudelft.nl/> <http://www.lartmaker.nl/>.
For details, take a look at <file:Documentation/cpu-freq/>. For details, take a look at <file:Documentation/cpu-freq/>.
......
...@@ -319,7 +319,6 @@ static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, ...@@ -319,7 +319,6 @@ static int cpufreq_parse_governor (char *str_governor, unsigned int *policy,
} }
return -EINVAL; return -EINVAL;
} }
EXPORT_SYMBOL_GPL(cpufreq_parse_governor);
/* drivers/base/cpu.c */ /* drivers/base/cpu.c */
...@@ -346,6 +345,8 @@ show_one(scaling_min_freq, min); ...@@ -346,6 +345,8 @@ show_one(scaling_min_freq, min);
show_one(scaling_max_freq, max); show_one(scaling_max_freq, max);
show_one(scaling_cur_freq, cur); show_one(scaling_cur_freq, cur);
static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_policy *policy);
/** /**
* cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access
*/ */
...@@ -364,7 +365,10 @@ static ssize_t store_##file_name \ ...@@ -364,7 +365,10 @@ static ssize_t store_##file_name \
if (ret != 1) \ if (ret != 1) \
return -EINVAL; \ return -EINVAL; \
\ \
ret = cpufreq_set_policy(&new_policy); \ mutex_lock(&policy->lock); \
ret = __cpufreq_set_policy(policy, &new_policy); \
policy->user_policy.object = policy->object; \
mutex_unlock(&policy->lock); \
\ \
return ret ? ret : count; \ return ret ? ret : count; \
} }
...@@ -420,7 +424,15 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, ...@@ -420,7 +424,15 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy,
if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor)) if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor))
return -EINVAL; return -EINVAL;
ret = cpufreq_set_policy(&new_policy); /* Do not use cpufreq_set_policy here or the user_policy.max
will be wrongly overridden */
mutex_lock(&policy->lock);
ret = __cpufreq_set_policy(policy, &new_policy);
policy->user_policy.policy = policy->policy;
policy->user_policy.governor = policy->governor;
mutex_unlock(&policy->lock);
return ret ? ret : count; return ret ? ret : count;
} }
...@@ -685,7 +697,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) ...@@ -685,7 +697,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
if (!cpu_online(j)) if (!cpu_online(j))
continue; continue;
dprintk("CPU already managed, adding link\n"); dprintk("CPU %u already managed, adding link\n", j);
cpufreq_cpu_get(cpu); cpufreq_cpu_get(cpu);
cpu_sys_dev = get_cpu_sysdev(j); cpu_sys_dev = get_cpu_sysdev(j);
sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj,
...@@ -697,7 +709,6 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) ...@@ -697,7 +709,6 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
mutex_unlock(&policy->lock); mutex_unlock(&policy->lock);
/* set default policy */ /* set default policy */
ret = cpufreq_set_policy(&new_policy); ret = cpufreq_set_policy(&new_policy);
if (ret) { if (ret) {
dprintk("setting policy failed\n"); dprintk("setting policy failed\n");
......
...@@ -176,8 +176,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused, ...@@ -176,8 +176,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused,
ret = sscanf (buf, "%u", &input); ret = sscanf (buf, "%u", &input);
mutex_lock(&dbs_mutex); mutex_lock(&dbs_mutex);
if (ret != 1 || input > 100 || input < 0 || if (ret != 1 || input > 100 || input <= dbs_tuners_ins.down_threshold) {
input <= dbs_tuners_ins.down_threshold) {
mutex_unlock(&dbs_mutex); mutex_unlock(&dbs_mutex);
return -EINVAL; return -EINVAL;
} }
...@@ -196,8 +195,7 @@ static ssize_t store_down_threshold(struct cpufreq_policy *unused, ...@@ -196,8 +195,7 @@ static ssize_t store_down_threshold(struct cpufreq_policy *unused,
ret = sscanf (buf, "%u", &input); ret = sscanf (buf, "%u", &input);
mutex_lock(&dbs_mutex); mutex_lock(&dbs_mutex);
if (ret != 1 || input > 100 || input < 0 || if (ret != 1 || input > 100 || input >= dbs_tuners_ins.up_threshold) {
input >= dbs_tuners_ins.up_threshold) {
mutex_unlock(&dbs_mutex); mutex_unlock(&dbs_mutex);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment