aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-10-29 09:34:13 -0400
committerTejun Heo <tj@kernel.org>2009-10-29 09:34:13 -0400
commitf16250669d78a32bdfb27cec4d791e85141e11e2 (patch)
treefa0fbce8904437312101a9b36f888c7a462e8d1f /drivers/cpufreq/cpufreq.c
parentb3e9f672b6cd0f4c2982c1bcc0b3c3fb39d3b0fe (diff)
percpu: make percpu symbols in cpufreq unique
This patch updates percpu related symbols in cpufreq such that percpu symbols are unique and don't clash with local symbols. This serves two purposes of decreasing the possibility of global percpu symbol collision and allowing dropping per_cpu__ prefix from percpu symbols. * drivers/cpufreq/cpufreq.c: s/policy_cpu/cpufreq_policy_cpu/ * drivers/cpufreq/freq_table.c: s/show_table/cpufreq_show_table/ * arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c: s/drv_data/acfreq_data/ s/old_perf/acfreq_old_perf/ Partly based on Rusty Russell's "alloc_percpu: rename percpu vars which cause name clashes" patch. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r--drivers/cpufreq/cpufreq.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 3938c7817095..af93a8175c5e 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -64,14 +64,14 @@ static DEFINE_SPINLOCK(cpufreq_driver_lock);
64 * - Lock should not be held across 64 * - Lock should not be held across
65 * __cpufreq_governor(data, CPUFREQ_GOV_STOP); 65 * __cpufreq_governor(data, CPUFREQ_GOV_STOP);
66 */ 66 */
67static DEFINE_PER_CPU(int, policy_cpu); 67static DEFINE_PER_CPU(int, cpufreq_policy_cpu);
68static DEFINE_PER_CPU(struct rw_semaphore, cpu_policy_rwsem); 68static DEFINE_PER_CPU(struct rw_semaphore, cpu_policy_rwsem);
69 69
70#define lock_policy_rwsem(mode, cpu) \ 70#define lock_policy_rwsem(mode, cpu) \
71int lock_policy_rwsem_##mode \ 71int lock_policy_rwsem_##mode \
72(int cpu) \ 72(int cpu) \
73{ \ 73{ \
74 int policy_cpu = per_cpu(policy_cpu, cpu); \ 74 int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu); \
75 BUG_ON(policy_cpu == -1); \ 75 BUG_ON(policy_cpu == -1); \
76 down_##mode(&per_cpu(cpu_policy_rwsem, policy_cpu)); \ 76 down_##mode(&per_cpu(cpu_policy_rwsem, policy_cpu)); \
77 if (unlikely(!cpu_online(cpu))) { \ 77 if (unlikely(!cpu_online(cpu))) { \
@@ -90,7 +90,7 @@ EXPORT_SYMBOL_GPL(lock_policy_rwsem_write);
90 90
91void unlock_policy_rwsem_read(int cpu) 91void unlock_policy_rwsem_read(int cpu)
92{ 92{
93 int policy_cpu = per_cpu(policy_cpu, cpu); 93 int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu);
94 BUG_ON(policy_cpu == -1); 94 BUG_ON(policy_cpu == -1);
95 up_read(&per_cpu(cpu_policy_rwsem, policy_cpu)); 95 up_read(&per_cpu(cpu_policy_rwsem, policy_cpu));
96} 96}
@@ -98,7 +98,7 @@ EXPORT_SYMBOL_GPL(unlock_policy_rwsem_read);
98 98
99void unlock_policy_rwsem_write(int cpu) 99void unlock_policy_rwsem_write(int cpu)
100{ 100{
101 int policy_cpu = per_cpu(policy_cpu, cpu); 101 int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu);
102 BUG_ON(policy_cpu == -1); 102 BUG_ON(policy_cpu == -1);
103 up_write(&per_cpu(cpu_policy_rwsem, policy_cpu)); 103 up_write(&per_cpu(cpu_policy_rwsem, policy_cpu));
104} 104}
@@ -799,7 +799,7 @@ int cpufreq_add_dev_policy(unsigned int cpu, struct cpufreq_policy *policy,
799 799
800 /* Set proper policy_cpu */ 800 /* Set proper policy_cpu */
801 unlock_policy_rwsem_write(cpu); 801 unlock_policy_rwsem_write(cpu);
802 per_cpu(policy_cpu, cpu) = managed_policy->cpu; 802 per_cpu(cpufreq_policy_cpu, cpu) = managed_policy->cpu;
803 803
804 if (lock_policy_rwsem_write(cpu) < 0) { 804 if (lock_policy_rwsem_write(cpu) < 0) {
805 /* Should not go through policy unlock path */ 805 /* Should not go through policy unlock path */
@@ -906,7 +906,7 @@ int cpufreq_add_dev_interface(unsigned int cpu, struct cpufreq_policy *policy,
906 if (!cpu_online(j)) 906 if (!cpu_online(j))
907 continue; 907 continue;
908 per_cpu(cpufreq_cpu_data, j) = policy; 908 per_cpu(cpufreq_cpu_data, j) = policy;
909 per_cpu(policy_cpu, j) = policy->cpu; 909 per_cpu(cpufreq_policy_cpu, j) = policy->cpu;
910 } 910 }
911 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 911 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
912 912
@@ -991,7 +991,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
991 cpumask_copy(policy->cpus, cpumask_of(cpu)); 991 cpumask_copy(policy->cpus, cpumask_of(cpu));
992 992
993 /* Initially set CPU itself as the policy_cpu */ 993 /* Initially set CPU itself as the policy_cpu */
994 per_cpu(policy_cpu, cpu) = cpu; 994 per_cpu(cpufreq_policy_cpu, cpu) = cpu;
995 ret = (lock_policy_rwsem_write(cpu) < 0); 995 ret = (lock_policy_rwsem_write(cpu) < 0);
996 WARN_ON(ret); 996 WARN_ON(ret);
997 997
@@ -1946,7 +1946,7 @@ static int __init cpufreq_core_init(void)
1946 int cpu; 1946 int cpu;
1947 1947
1948 for_each_possible_cpu(cpu) { 1948 for_each_possible_cpu(cpu) {
1949 per_cpu(policy_cpu, cpu) = -1; 1949 per_cpu(cpufreq_policy_cpu, cpu) = -1;
1950 init_rwsem(&per_cpu(cpu_policy_rwsem, cpu)); 1950 init_rwsem(&per_cpu(cpu_policy_rwsem, cpu));
1951 } 1951 }
1952 1952