Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163090
b: refs/heads/master
c: 19d6f7e
h: refs/heads/master
v: v3
  • Loading branch information
Dave Jones committed Sep 1, 2009
1 parent 1d8e0ca commit 7ae3f78
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 059019a3c3353b15d8efac5301f72036cc408bd4
refs/heads/master: 19d6f7ec3eb1652fc89dd05ebcc2a21a95c60a5a
51 changes: 31 additions & 20 deletions trunk/drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,34 @@ static struct kobj_type ktype_cpufreq = {
.release = cpufreq_sysfs_release,
};

/* symlink affected CPUs */
int cpufreq_add_dev_symlink(unsigned int cpu, struct cpufreq_policy *policy)
{
unsigned int j;
int ret = 0;

for_each_cpu(j, policy->cpus) {
struct cpufreq_policy *managed_policy;
struct sys_device *cpu_sys_dev;

if (j == cpu)
continue;
if (!cpu_online(j))
continue;

dprintk("CPU %u already managed, adding link\n", j);
managed_policy = cpufreq_cpu_get(cpu);
cpu_sys_dev = get_cpu_sysdev(j);
ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj,
"cpufreq");
if (ret) {
cpufreq_cpu_put(managed_policy);
return ret;
}
}
return ret;
}


/**
* cpufreq_add_dev - add a CPU device
Expand Down Expand Up @@ -929,26 +957,9 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
}
spin_unlock_irqrestore(&cpufreq_driver_lock, flags);

/* symlink affected CPUs */
for_each_cpu(j, policy->cpus) {
struct cpufreq_policy *managed_policy;
struct sys_device *cpu_sys_dev;

if (j == cpu)
continue;
if (!cpu_online(j))
continue;

dprintk("CPU %u already managed, adding link\n", j);
managed_policy = cpufreq_cpu_get(cpu);
cpu_sys_dev = get_cpu_sysdev(j);
ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj,
"cpufreq");
if (ret) {
cpufreq_cpu_put(managed_policy);
goto err_out_unregister;
}
}
ret = cpufreq_add_dev_symlink(cpu, policy->cpus, policy);
if (ret)
goto err_out_unregister;

policy->governor = NULL; /* to assure that the starting sequence is
* run in cpufreq_set_policy */
Expand Down

0 comments on commit 7ae3f78

Please sign in to comment.