diff options
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 06eeff3c822f..7600c10d275a 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -756,6 +756,34 @@ static struct kobj_type ktype_cpufreq = { | |||
756 | .release = cpufreq_sysfs_release, | 756 | .release = cpufreq_sysfs_release, |
757 | }; | 757 | }; |
758 | 758 | ||
759 | /* symlink affected CPUs */ | ||
760 | int cpufreq_add_dev_symlink(unsigned int cpu, struct cpufreq_policy *policy) | ||
761 | { | ||
762 | unsigned int j; | ||
763 | int ret = 0; | ||
764 | |||
765 | for_each_cpu(j, policy->cpus) { | ||
766 | struct cpufreq_policy *managed_policy; | ||
767 | struct sys_device *cpu_sys_dev; | ||
768 | |||
769 | if (j == cpu) | ||
770 | continue; | ||
771 | if (!cpu_online(j)) | ||
772 | continue; | ||
773 | |||
774 | dprintk("CPU %u already managed, adding link\n", j); | ||
775 | managed_policy = cpufreq_cpu_get(cpu); | ||
776 | cpu_sys_dev = get_cpu_sysdev(j); | ||
777 | ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, | ||
778 | "cpufreq"); | ||
779 | if (ret) { | ||
780 | cpufreq_cpu_put(managed_policy); | ||
781 | return ret; | ||
782 | } | ||
783 | } | ||
784 | return ret; | ||
785 | } | ||
786 | |||
759 | 787 | ||
760 | /** | 788 | /** |
761 | * cpufreq_add_dev - add a CPU device | 789 | * cpufreq_add_dev - add a CPU device |
@@ -929,26 +957,9 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
929 | } | 957 | } |
930 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 958 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
931 | 959 | ||
932 | /* symlink affected CPUs */ | 960 | ret = cpufreq_add_dev_symlink(cpu, policy->cpus, policy); |
933 | for_each_cpu(j, policy->cpus) { | 961 | if (ret) |
934 | struct cpufreq_policy *managed_policy; | 962 | goto err_out_unregister; |
935 | struct sys_device *cpu_sys_dev; | ||
936 | |||
937 | if (j == cpu) | ||
938 | continue; | ||
939 | if (!cpu_online(j)) | ||
940 | continue; | ||
941 | |||
942 | dprintk("CPU %u already managed, adding link\n", j); | ||
943 | managed_policy = cpufreq_cpu_get(cpu); | ||
944 | cpu_sys_dev = get_cpu_sysdev(j); | ||
945 | ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, | ||
946 | "cpufreq"); | ||
947 | if (ret) { | ||
948 | cpufreq_cpu_put(managed_policy); | ||
949 | goto err_out_unregister; | ||
950 | } | ||
951 | } | ||
952 | 963 | ||
953 | policy->governor = NULL; /* to assure that the starting sequence is | 964 | policy->governor = NULL; /* to assure that the starting sequence is |
954 | * run in cpufreq_set_policy */ | 965 | * run in cpufreq_set_policy */ |