aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorThomas Renninger <trenn@suse.de>2009-07-24 09:25:03 -0400
committerDave Jones <davej@redhat.com>2009-09-01 12:45:14 -0400
commit4bfa042cd304aa48cf05cd0a13c2d0794a675c0e (patch)
treec2f1a8cfa8d34d7e364acde2a2391481beeee77e /drivers/cpufreq
parentecf7e4611c89aba7c7fde1183f7e9357695fbcc5 (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.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 845687884c1e..bbd5c2164ab6 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -756,7 +756,12 @@ static struct kobj_type ktype_cpufreq = {
756 .release = cpufreq_sysfs_release, 756 .release = cpufreq_sysfs_release,
757}; 757};
758 758
759 759/*
760 * Returns:
761 * Negative: Failure
762 * 0: Success
763 * Positive: When we have a managed CPU and the sysfs got symlinked
764 */
760int cpufreq_add_dev_policy(unsigned int cpu, struct cpufreq_policy *policy, 765int cpufreq_add_dev_policy(unsigned int cpu, struct cpufreq_policy *policy,
761 struct sys_device *sys_dev) 766 struct sys_device *sys_dev)
762{ 767{
@@ -817,7 +822,11 @@ int cpufreq_add_dev_policy(unsigned int cpu, struct cpufreq_policy *policy,
817 */ 822 */
818 if (cpufreq_driver->exit) 823 if (cpufreq_driver->exit)
819 cpufreq_driver->exit(policy); 824 cpufreq_driver->exit(policy);
820 return ret; 825
826 if (!ret)
827 return 1;
828 else
829 return ret;
821 } 830 }
822 } 831 }
823#endif 832#endif
@@ -1001,8 +1010,13 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
1001 CPUFREQ_START, policy); 1010 CPUFREQ_START, policy);
1002 1011
1003 ret = cpufreq_add_dev_policy(cpu, policy, sys_dev); 1012 ret = cpufreq_add_dev_policy(cpu, policy, sys_dev);
1004 if (ret) 1013 if (ret) {
1014 if (ret > 0)
1015 /* This is a managed cpu, symlink created,
1016 exit with 0 */
1017 ret = 0;
1005 goto err_unlock_policy; 1018 goto err_unlock_policy;
1019 }
1006 1020
1007 ret = cpufreq_add_dev_interface(cpu, policy, sys_dev); 1021 ret = cpufreq_add_dev_interface(cpu, policy, sys_dev);
1008 if (ret) 1022 if (ret)