diff options
author | Thomas Renninger <trenn@suse.de> | 2009-07-24 15:25:03 +0200 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2009-09-01 12:45:14 -0400 |
commit | 4bfa042cd304aa48cf05cd0a13c2d0794a675c0e (patch) | |
tree | c2f1a8cfa8d34d7e364acde2a2391481beeee77e /drivers/cpufreq | |
parent | ecf7e4611c89aba7c7fde1183f7e9357695fbcc5 (diff) |
[CPUFREQ] Bail out of cpufreq_add_dev if the link for a managed CPU got created
Doing:
echo 0 >cpu1/online
echo 1 >cpu1/online
on a managed CPU will result in:
Jul 22 15:15:37 linux kernel: [ 80.013864] WARNING: at fs/sysfs/dir.c:487 sysfs_add_one+0xcf/0xe6()
Jul 22 15:15:37 linux kernel: [ 80.013866] Hardware name: To Be Filled By O.E.M.
Jul 22 15:15:37 linux kernel: [ 80.013868] sysfs: cannot create duplicate filename '/devices/system/cpu/cpu1/cpufreq'
Jul 22 15:15:37 linux kernel: [ 80.013870] Modules linked in: powernow_k8
Jul 22 15:15:37 linux kernel: [ 80.013874] Pid: 5750, comm: bash Not tainted 2.6.31-rc2 #40
Jul 22 15:15:37 linux kernel: [ 80.013876] Call Trace:
Jul 22 15:15:37 linux kernel: [ 80.013879] [<ffffffff8112ebda>] ? sysfs_add_one+0xcf/0xe6
Jul 22 15:15:37 linux kernel: [ 80.013884] [<ffffffff81041926>] warn_slowpath_common+0x77/0xa4
Jul 22 15:15:37 linux kernel: [ 80.013888] [<ffffffff810419a0>] warn_slowpath_fmt+0x3c/0x3e
Jul 22 15:15:37 linux kernel: [ 80.013891] [<ffffffff8112ebda>] sysfs_add_one+0xcf/0xe6
Jul 22 15:15:37 linux kernel: [ 80.013894] [<ffffffff8112f213>] create_dir+0x58/0x87
Jul 22 15:15:37 linux kernel: [ 80.013898] [<ffffffff8112f27a>] sysfs_create_dir+0x38/0x4f
Jul 22 15:15:37 linux kernel: [ 80.013902] [<ffffffff811ffb8a>] kobject_add_internal+0x11f/0x1de
Jul 22 15:15:37 linux kernel: [ 80.013905] [<ffffffff811ffd21>] kobject_add_varg+0x41/0x4e
Jul 22 15:15:37 linux kernel: [ 80.013908] [<ffffffff811ffd7a>] kobject_init_and_add+0x4c/0x57
Jul 22 15:15:37 linux kernel: [ 80.013913] [<ffffffff810667bc>] ? mark_lock+0x22/0x228
Jul 22 15:15:37 linux kernel: [ 80.013918] [<ffffffff813e8a3b>] cpufreq_add_dev_interface+0x40/0x1e4
...
This bug slipped in by git commit:
150b06f7f223cfd0f808737a5243cceca8ea47fa
When splitting up cpufreq_add_dev, the whole cpufreq_add_dev function
is not left anymore, only cpufreq_add_dev_policy.
This patch should reconstruct the identical functionality again as it
was before the split.
CC: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 845687884c1..bbd5c2164ab 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -756,7 +756,12 @@ static struct kobj_type ktype_cpufreq = { .release = cpufreq_sysfs_release, }; - +/* + * Returns: + * Negative: Failure + * 0: Success + * Positive: When we have a managed CPU and the sysfs got symlinked + */ int cpufreq_add_dev_policy(unsigned int cpu, struct cpufreq_policy *policy, struct sys_device *sys_dev) { @@ -817,7 +822,11 @@ int cpufreq_add_dev_policy(unsigned int cpu, struct cpufreq_policy *policy, */ if (cpufreq_driver->exit) cpufreq_driver->exit(policy); - return ret; + + if (!ret) + return 1; + else + return ret; } } #endif @@ -1001,8 +1010,13 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) CPUFREQ_START, policy); ret = cpufreq_add_dev_policy(cpu, policy, sys_dev); - if (ret) + if (ret) { + if (ret > 0) + /* This is a managed cpu, symlink created, + exit with 0 */ + ret = 0; goto err_unlock_policy; + } ret = cpufreq_add_dev_interface(cpu, policy, sys_dev); if (ret) |