diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2013-08-03 19:20:07 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-08-07 17:02:50 -0400 |
commit | d8d3b4711297e101bbad826474013edbe342c333 (patch) | |
tree | af0786e2884a0d31b9c0506ed8d01ee1ccc44414 | |
parent | 10659ab7b50e963429f1a681882404ca37aa584c (diff) |
cpufreq: Pass policy to cpufreq_add_policy_cpu()
The caller of cpufreq_add_policy_cpu() already has a pointer to the
policy structure and there is no need to look it up again in
cpufreq_add_policy_cpu(). Let's pass it directly.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 924d3f5df26d..1faf320a5038 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -897,21 +897,17 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy) | |||
897 | } | 897 | } |
898 | 898 | ||
899 | #ifdef CONFIG_HOTPLUG_CPU | 899 | #ifdef CONFIG_HOTPLUG_CPU |
900 | static int cpufreq_add_policy_cpu(unsigned int cpu, unsigned int sibling, | 900 | static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, |
901 | struct device *dev, bool frozen) | 901 | unsigned int cpu, struct device *dev, |
902 | bool frozen) | ||
902 | { | 903 | { |
903 | struct cpufreq_policy *policy; | ||
904 | int ret = 0, has_target = !!cpufreq_driver->target; | 904 | int ret = 0, has_target = !!cpufreq_driver->target; |
905 | unsigned long flags; | 905 | unsigned long flags; |
906 | 906 | ||
907 | policy = cpufreq_cpu_get(sibling); | ||
908 | if (WARN_ON_ONCE(!policy)) | ||
909 | return -ENODATA; | ||
910 | |||
911 | if (has_target) | 907 | if (has_target) |
912 | __cpufreq_governor(policy, CPUFREQ_GOV_STOP); | 908 | __cpufreq_governor(policy, CPUFREQ_GOV_STOP); |
913 | 909 | ||
914 | lock_policy_rwsem_write(sibling); | 910 | lock_policy_rwsem_write(policy->cpu); |
915 | 911 | ||
916 | write_lock_irqsave(&cpufreq_driver_lock, flags); | 912 | write_lock_irqsave(&cpufreq_driver_lock, flags); |
917 | 913 | ||
@@ -920,7 +916,7 @@ static int cpufreq_add_policy_cpu(unsigned int cpu, unsigned int sibling, | |||
920 | per_cpu(cpufreq_cpu_data, cpu) = policy; | 916 | per_cpu(cpufreq_cpu_data, cpu) = policy; |
921 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); | 917 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); |
922 | 918 | ||
923 | unlock_policy_rwsem_write(sibling); | 919 | unlock_policy_rwsem_write(policy->cpu); |
924 | 920 | ||
925 | if (has_target) { | 921 | if (has_target) { |
926 | __cpufreq_governor(policy, CPUFREQ_GOV_START); | 922 | __cpufreq_governor(policy, CPUFREQ_GOV_START); |
@@ -931,7 +927,6 @@ static int cpufreq_add_policy_cpu(unsigned int cpu, unsigned int sibling, | |||
931 | if (!frozen) | 927 | if (!frozen) |
932 | ret = sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq"); | 928 | ret = sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq"); |
933 | 929 | ||
934 | cpufreq_cpu_put(policy); | ||
935 | return ret; | 930 | return ret; |
936 | } | 931 | } |
937 | #endif | 932 | #endif |
@@ -1014,8 +1009,7 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, | |||
1014 | struct cpufreq_policy *cp = per_cpu(cpufreq_cpu_data, sibling); | 1009 | struct cpufreq_policy *cp = per_cpu(cpufreq_cpu_data, sibling); |
1015 | if (cp && cpumask_test_cpu(cpu, cp->related_cpus)) { | 1010 | if (cp && cpumask_test_cpu(cpu, cp->related_cpus)) { |
1016 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1011 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); |
1017 | return cpufreq_add_policy_cpu(cpu, sibling, dev, | 1012 | return cpufreq_add_policy_cpu(cp, cpu, dev, frozen); |
1018 | frozen); | ||
1019 | } | 1013 | } |
1020 | } | 1014 | } |
1021 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1015 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); |