aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2008-04-04 21:11:05 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-19 13:44:58 -0400
commitfc0e474840d1fd96f28fbd76d4f36b80e7ad1cc3 (patch)
tree6076cf6b77f84557d1df0c2c95091387d5b609ad /arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
parent434d53b00d6bb7be0a1d3dcc0d0d5df6c042e164 (diff)
x86: use new set_cpus_allowed_ptr function
* Use new set_cpus_allowed_ptr() function added by previous patch, which instead of passing the "newly allowed cpus" cpumask_t arg by value, pass it by pointer: -int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) +int set_cpus_allowed_ptr(struct task_struct *p, const cpumask_t *new_mask) * Cleanup uses of CPU_MASK_ALL. * Collapse other NR_CPUS changes to arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c Use pointers to cpumask_t arguments whenever possible. Depends on: [sched-devel]: sched: add new set_cpus_allowed_ptr function Cc: Len Brown <len.brown@intel.com> Cc: Dave Jones <davej@codemonkey.org.uk> Signed-off-by: Mike Travis <travis@sgi.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c')
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index a962dcb9c40..e2d870de837 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -192,9 +192,9 @@ static void drv_read(struct drv_cmd *cmd)
192 cpumask_t saved_mask = current->cpus_allowed; 192 cpumask_t saved_mask = current->cpus_allowed;
193 cmd->val = 0; 193 cmd->val = 0;
194 194
195 set_cpus_allowed(current, cmd->mask); 195 set_cpus_allowed_ptr(current, &cmd->mask);
196 do_drv_read(cmd); 196 do_drv_read(cmd);
197 set_cpus_allowed(current, saved_mask); 197 set_cpus_allowed_ptr(current, &saved_mask);
198} 198}
199 199
200static void drv_write(struct drv_cmd *cmd) 200static void drv_write(struct drv_cmd *cmd)
@@ -203,30 +203,30 @@ static void drv_write(struct drv_cmd *cmd)
203 unsigned int i; 203 unsigned int i;
204 204
205 for_each_cpu_mask(i, cmd->mask) { 205 for_each_cpu_mask(i, cmd->mask) {
206 set_cpus_allowed(current, cpumask_of_cpu(i)); 206 set_cpus_allowed_ptr(current, &cpumask_of_cpu(i));
207 do_drv_write(cmd); 207 do_drv_write(cmd);
208 } 208 }
209 209
210 set_cpus_allowed(current, saved_mask); 210 set_cpus_allowed_ptr(current, &saved_mask);
211 return; 211 return;
212} 212}
213 213
214static u32 get_cur_val(cpumask_t mask) 214static u32 get_cur_val(const cpumask_t *mask)
215{ 215{
216 struct acpi_processor_performance *perf; 216 struct acpi_processor_performance *perf;
217 struct drv_cmd cmd; 217 struct drv_cmd cmd;
218 218
219 if (unlikely(cpus_empty(mask))) 219 if (unlikely(cpus_empty(*mask)))
220 return 0; 220 return 0;
221 221
222 switch (per_cpu(drv_data, first_cpu(mask))->cpu_feature) { 222 switch (per_cpu(drv_data, first_cpu(*mask))->cpu_feature) {
223 case SYSTEM_INTEL_MSR_CAPABLE: 223 case SYSTEM_INTEL_MSR_CAPABLE:
224 cmd.type = SYSTEM_INTEL_MSR_CAPABLE; 224 cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
225 cmd.addr.msr.reg = MSR_IA32_PERF_STATUS; 225 cmd.addr.msr.reg = MSR_IA32_PERF_STATUS;
226 break; 226 break;
227 case SYSTEM_IO_CAPABLE: 227 case SYSTEM_IO_CAPABLE:
228 cmd.type = SYSTEM_IO_CAPABLE; 228 cmd.type = SYSTEM_IO_CAPABLE;
229 perf = per_cpu(drv_data, first_cpu(mask))->acpi_data; 229 perf = per_cpu(drv_data, first_cpu(*mask))->acpi_data;
230 cmd.addr.io.port = perf->control_register.address; 230 cmd.addr.io.port = perf->control_register.address;
231 cmd.addr.io.bit_width = perf->control_register.bit_width; 231 cmd.addr.io.bit_width = perf->control_register.bit_width;
232 break; 232 break;
@@ -234,7 +234,7 @@ static u32 get_cur_val(cpumask_t mask)
234 return 0; 234 return 0;
235 } 235 }
236 236
237 cmd.mask = mask; 237 cmd.mask = *mask;
238 238
239 drv_read(&cmd); 239 drv_read(&cmd);
240 240
@@ -271,7 +271,7 @@ static unsigned int get_measured_perf(unsigned int cpu)
271 unsigned int retval; 271 unsigned int retval;
272 272
273 saved_mask = current->cpus_allowed; 273 saved_mask = current->cpus_allowed;
274 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 274 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
275 if (get_cpu() != cpu) { 275 if (get_cpu() != cpu) {
276 /* We were not able to run on requested processor */ 276 /* We were not able to run on requested processor */
277 put_cpu(); 277 put_cpu();
@@ -329,7 +329,7 @@ static unsigned int get_measured_perf(unsigned int cpu)
329 retval = per_cpu(drv_data, cpu)->max_freq * perf_percent / 100; 329 retval = per_cpu(drv_data, cpu)->max_freq * perf_percent / 100;
330 330
331 put_cpu(); 331 put_cpu();
332 set_cpus_allowed(current, saved_mask); 332 set_cpus_allowed_ptr(current, &saved_mask);
333 333
334 dprintk("cpu %d: performance percent %d\n", cpu, perf_percent); 334 dprintk("cpu %d: performance percent %d\n", cpu, perf_percent);
335 return retval; 335 return retval;
@@ -347,13 +347,13 @@ static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
347 return 0; 347 return 0;
348 } 348 }
349 349
350 freq = extract_freq(get_cur_val(cpumask_of_cpu(cpu)), data); 350 freq = extract_freq(get_cur_val(&cpumask_of_cpu(cpu)), data);
351 dprintk("cur freq = %u\n", freq); 351 dprintk("cur freq = %u\n", freq);
352 352
353 return freq; 353 return freq;
354} 354}
355 355
356static unsigned int check_freqs(cpumask_t mask, unsigned int freq, 356static unsigned int check_freqs(const cpumask_t *mask, unsigned int freq,
357 struct acpi_cpufreq_data *data) 357 struct acpi_cpufreq_data *data)
358{ 358{
359 unsigned int cur_freq; 359 unsigned int cur_freq;
@@ -449,7 +449,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
449 drv_write(&cmd); 449 drv_write(&cmd);
450 450
451 if (acpi_pstate_strict) { 451 if (acpi_pstate_strict) {
452 if (!check_freqs(cmd.mask, freqs.new, data)) { 452 if (!check_freqs(&cmd.mask, freqs.new, data)) {
453 dprintk("acpi_cpufreq_target failed (%d)\n", 453 dprintk("acpi_cpufreq_target failed (%d)\n",
454 policy->cpu); 454 policy->cpu);
455 return -EAGAIN; 455 return -EAGAIN;