Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
Browse files Browse the repository at this point in the history
* 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()
  • Loading branch information
Linus Torvalds committed Apr 19, 2006
2 parents c63f774 + 9180053 commit c63fdee
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Documentation/cpu-freq/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ the CPUFreq Mailing list:
* http://lists.linux.org.uk/mailman/listinfo/cpufreq

Clock and voltage scaling for the SA-1100:
* http://www.lart.tudelft.nl/projects/scaling
* http://www.lartmaker.nl/projects/scaling
10 changes: 5 additions & 5 deletions arch/i386/kernel/cpu/cpufreq/powernow-k8.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,14 +905,17 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
{
cpumask_t oldmask = CPU_MASK_ALL;
struct powernow_k8_data *data = powernow_data[pol->cpu];
u32 checkfid = data->currfid;
u32 checkvid = data->currvid;
u32 checkfid;
u32 checkvid;
unsigned int newstate;
int ret = -EIO;

if (!data)
return -EINVAL;

checkfid = data->currfid;
checkvid = data->currvid;

/* only run on specific CPU from here on */
oldmask = current->cpus_allowed;
set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
Expand Down Expand Up @@ -1106,9 +1109,6 @@ static unsigned int powernowk8_get (unsigned int cpu)

data = powernow_data[first_cpu(cpu_core_map[cpu])];

if (!data)
return -EINVAL;

if (!data)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/cpufreq/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ config CPU_FREQ_GOV_USERSPACE
Enable this cpufreq governor when you either want to set the
CPU frequency manually or when an userspace program shall
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/>.

Expand Down
25 changes: 18 additions & 7 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ static int cpufreq_parse_governor (char *str_governor, unsigned int *policy,
}
return -EINVAL;
}
EXPORT_SYMBOL_GPL(cpufreq_parse_governor);


/* drivers/base/cpu.c */
Expand All @@ -346,6 +345,8 @@ show_one(scaling_min_freq, min);
show_one(scaling_max_freq, max);
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
*/
Expand All @@ -364,7 +365,10 @@ static ssize_t store_##file_name \
if (ret != 1) \
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; \
}
Expand Down Expand Up @@ -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))
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;
}

Expand Down Expand Up @@ -685,7 +697,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
if (!cpu_online(j))
continue;

dprintk("CPU already managed, adding link\n");
dprintk("CPU %u already managed, adding link\n", j);
cpufreq_cpu_get(cpu);
cpu_sys_dev = get_cpu_sysdev(j);
sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj,
Expand All @@ -695,9 +707,8 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
policy->governor = NULL; /* to assure that the starting sequence is
* run in cpufreq_set_policy */
mutex_unlock(&policy->lock);

/* set default policy */

ret = cpufreq_set_policy(&new_policy);
if (ret) {
dprintk("setting policy failed\n");
Expand All @@ -707,7 +718,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
module_put(cpufreq_driver->owner);
dprintk("initialization complete\n");
cpufreq_debug_enable_ratelimit();

return 0;


Expand Down
6 changes: 2 additions & 4 deletions drivers/cpufreq/cpufreq_conservative.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused,
ret = sscanf (buf, "%u", &input);

mutex_lock(&dbs_mutex);
if (ret != 1 || input > 100 || input < 0 ||
input <= dbs_tuners_ins.down_threshold) {
if (ret != 1 || input > 100 || input <= dbs_tuners_ins.down_threshold) {
mutex_unlock(&dbs_mutex);
return -EINVAL;
}
Expand All @@ -196,8 +195,7 @@ static ssize_t store_down_threshold(struct cpufreq_policy *unused,
ret = sscanf (buf, "%u", &input);

mutex_lock(&dbs_mutex);
if (ret != 1 || input > 100 || input < 0 ||
input >= dbs_tuners_ins.up_threshold) {
if (ret != 1 || input > 100 || input >= dbs_tuners_ins.up_threshold) {
mutex_unlock(&dbs_mutex);
return -EINVAL;
}
Expand Down

0 comments on commit c63fdee

Please sign in to comment.