aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2008-03-05 11:31:29 -0500
committerDave Jones <davej@redhat.com>2008-04-28 15:05:44 -0400
commitc938ac21329f19ad286eaaed7e26434943c8061b (patch)
tree2ba5674661276765607ddbae7674b914cbcc9267 /drivers/acpi
parent25aca347d49ffc38aa3b7e63ce9b90df7f8b79c8 (diff)
[CPUFREQ] change cpu freq tables to per_cpu variables
Change cpufreq tables from arrays to per_cpu variables in drivers/acpi/processor_thermal.c Based on git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git Cc: Len Brown <len.brown@intel.com> Signed-off-by: Mike Travis <travis@sgi.com> Signed-off-by: Dave Jones <davej@codemonkey.org.uk>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/processor_thermal.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c
index 9cb43f52f7b6..649ae99b9216 100644
--- a/drivers/acpi/processor_thermal.c
+++ b/drivers/acpi/processor_thermal.c
@@ -97,7 +97,7 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr)
97#define CPUFREQ_THERMAL_MIN_STEP 0 97#define CPUFREQ_THERMAL_MIN_STEP 0
98#define CPUFREQ_THERMAL_MAX_STEP 3 98#define CPUFREQ_THERMAL_MAX_STEP 3
99 99
100static unsigned int cpufreq_thermal_reduction_pctg[NR_CPUS]; 100static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_reduction_pctg);
101static unsigned int acpi_thermal_cpufreq_is_init = 0; 101static unsigned int acpi_thermal_cpufreq_is_init = 0;
102 102
103static int cpu_has_cpufreq(unsigned int cpu) 103static int cpu_has_cpufreq(unsigned int cpu)
@@ -113,9 +113,9 @@ static int acpi_thermal_cpufreq_increase(unsigned int cpu)
113 if (!cpu_has_cpufreq(cpu)) 113 if (!cpu_has_cpufreq(cpu))
114 return -ENODEV; 114 return -ENODEV;
115 115
116 if (cpufreq_thermal_reduction_pctg[cpu] < 116 if (per_cpu(cpufreq_thermal_reduction_pctg, cpu) <
117 CPUFREQ_THERMAL_MAX_STEP) { 117 CPUFREQ_THERMAL_MAX_STEP) {
118 cpufreq_thermal_reduction_pctg[cpu]++; 118 per_cpu(cpufreq_thermal_reduction_pctg, cpu)++;
119 cpufreq_update_policy(cpu); 119 cpufreq_update_policy(cpu);
120 return 0; 120 return 0;
121 } 121 }
@@ -128,14 +128,14 @@ static int acpi_thermal_cpufreq_decrease(unsigned int cpu)
128 if (!cpu_has_cpufreq(cpu)) 128 if (!cpu_has_cpufreq(cpu))
129 return -ENODEV; 129 return -ENODEV;
130 130
131 if (cpufreq_thermal_reduction_pctg[cpu] > 131 if (per_cpu(cpufreq_thermal_reduction_pctg, cpu) >
132 (CPUFREQ_THERMAL_MIN_STEP + 1)) 132 (CPUFREQ_THERMAL_MIN_STEP + 1))
133 cpufreq_thermal_reduction_pctg[cpu]--; 133 per_cpu(cpufreq_thermal_reduction_pctg, cpu)--;
134 else 134 else
135 cpufreq_thermal_reduction_pctg[cpu] = 0; 135 per_cpu(cpufreq_thermal_reduction_pctg, cpu) = 0;
136 cpufreq_update_policy(cpu); 136 cpufreq_update_policy(cpu);
137 /* We reached max freq again and can leave passive mode */ 137 /* We reached max freq again and can leave passive mode */
138 return !cpufreq_thermal_reduction_pctg[cpu]; 138 return !per_cpu(cpufreq_thermal_reduction_pctg, cpu);
139} 139}
140 140
141static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb, 141static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb,
@@ -147,9 +147,10 @@ static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb,
147 if (event != CPUFREQ_ADJUST) 147 if (event != CPUFREQ_ADJUST)
148 goto out; 148 goto out;
149 149
150 max_freq = 150 max_freq = (
151 (policy->cpuinfo.max_freq * 151 policy->cpuinfo.max_freq *
152 (100 - cpufreq_thermal_reduction_pctg[policy->cpu] * 20)) / 100; 152 (100 - per_cpu(cpufreq_thermal_reduction_pctg, policy->cpu) * 20)
153 ) / 100;
153 154
154 cpufreq_verify_within_limits(policy, 0, max_freq); 155 cpufreq_verify_within_limits(policy, 0, max_freq);
155 156
@@ -174,7 +175,7 @@ static int cpufreq_get_cur_state(unsigned int cpu)
174 if (!cpu_has_cpufreq(cpu)) 175 if (!cpu_has_cpufreq(cpu))
175 return 0; 176 return 0;
176 177
177 return cpufreq_thermal_reduction_pctg[cpu]; 178 return per_cpu(cpufreq_thermal_reduction_pctg, cpu);
178} 179}
179 180
180static int cpufreq_set_cur_state(unsigned int cpu, int state) 181static int cpufreq_set_cur_state(unsigned int cpu, int state)
@@ -182,7 +183,7 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state)
182 if (!cpu_has_cpufreq(cpu)) 183 if (!cpu_has_cpufreq(cpu))
183 return 0; 184 return 0;
184 185
185 cpufreq_thermal_reduction_pctg[cpu] = state; 186 per_cpu(cpufreq_thermal_reduction_pctg, cpu) = state;
186 cpufreq_update_policy(cpu); 187 cpufreq_update_policy(cpu);
187 return 0; 188 return 0;
188} 189}
@@ -191,8 +192,9 @@ void acpi_thermal_cpufreq_init(void)
191{ 192{
192 int i; 193 int i;
193 194
194 for (i = 0; i < NR_CPUS; i++) 195 for (i = 0; i < nr_cpu_ids; i++)
195 cpufreq_thermal_reduction_pctg[i] = 0; 196 if (cpu_present(i))
197 per_cpu(cpufreq_thermal_reduction_pctg, i) = 0;
196 198
197 i = cpufreq_register_notifier(&acpi_thermal_cpufreq_notifier_block, 199 i = cpufreq_register_notifier(&acpi_thermal_cpufreq_notifier_block,
198 CPUFREQ_POLICY_NOTIFIER); 200 CPUFREQ_POLICY_NOTIFIER);