aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/cpufreq/cpufreq.c12
-rw-r--r--include/linux/cpufreq.h1
2 files changed, 13 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);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 29208923c9d3..431a05d4b4c9 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -82,6 +82,7 @@ struct cpufreq_policy {
82 82
83 struct cpufreq_real_policy user_policy; 83 struct cpufreq_real_policy user_policy;
84 84
85 struct list_head policy_list;
85 struct kobject kobj; 86 struct kobject kobj;
86 struct completion kobj_unregister; 87 struct completion kobj_unregister;
87 int transition_ongoing; /* Tracks transition status */ 88 int transition_ongoing; /* Tracks transition status */