aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLukasz Majewski <l.majewski@samsung.com>2013-08-06 13:23:08 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-08-09 21:24:06 -0400
commitc88a1f8b96e7384627b918dfabbfc0c615a4a914 (patch)
treecc628531b29544c5ce24a8963adbcb3bef38c04a /drivers
parentd5b73cd870e2b049ef566aec2791dbf5fd26a7ec (diff)
cpufreq: Store cpufreq policies in a list
Policies available in the cpufreq framework are now linked together. They are accessible via cpufreq_policy_list defined in the cpufreq core. [rjw: Fix from Yinghai Lu folded in] Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cpufreq/cpufreq.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 9e83d9142072..75c5bd424d59 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -40,6 +40,7 @@ static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);
40static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data_fallback); 40static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data_fallback);
41static DEFINE_RWLOCK(cpufreq_driver_lock); 41static DEFINE_RWLOCK(cpufreq_driver_lock);
42static DEFINE_MUTEX(cpufreq_governor_lock); 42static DEFINE_MUTEX(cpufreq_governor_lock);
43static LIST_HEAD(cpufreq_policy_list);
43 44
44#ifdef CONFIG_HOTPLUG_CPU 45#ifdef CONFIG_HOTPLUG_CPU
45/* This one keeps track of the previously set governor of a removed CPU */ 46/* This one keeps track of the previously set governor of a removed CPU */
@@ -952,6 +953,7 @@ static struct cpufreq_policy *cpufreq_policy_alloc(void)
952 if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) 953 if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL))
953 goto err_free_cpumask; 954 goto err_free_cpumask;
954 955
956 INIT_LIST_HEAD(&policy->policy_list);
955 return policy; 957 return policy;
956 958
957err_free_cpumask: 959err_free_cpumask:
@@ -964,6 +966,12 @@ err_free_policy:
964 966
965static void cpufreq_policy_free(struct cpufreq_policy *policy) 967static void cpufreq_policy_free(struct cpufreq_policy *policy)
966{ 968{
969 unsigned long flags;
970
971 write_lock_irqsave(&cpufreq_driver_lock, flags);
972 list_del(&policy->policy_list);
973 write_unlock_irqrestore(&cpufreq_driver_lock, flags);
974
967 free_cpumask_var(policy->related_cpus); 975 free_cpumask_var(policy->related_cpus);
968 free_cpumask_var(policy->cpus); 976 free_cpumask_var(policy->cpus);
969 kfree(policy); 977 kfree(policy);
@@ -1077,6 +1085,10 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
1077 ret = cpufreq_add_dev_interface(policy, dev); 1085 ret = cpufreq_add_dev_interface(policy, dev);
1078 if (ret) 1086 if (ret)
1079 goto err_out_unregister; 1087 goto err_out_unregister;
1088
1089 write_lock_irqsave(&cpufreq_driver_lock, flags);
1090 list_add(&policy->policy_list, &cpufreq_policy_list);
1091 write_unlock_irqrestore(&cpufreq_driver_lock, flags);
1080 } 1092 }
1081 1093
1082 cpufreq_init_policy(policy); 1094 cpufreq_init_policy(policy);