diff options
Diffstat (limited to 'arch/x86/kernel/cpu/cpufreq')
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 25 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/longhaul.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/powernow-k8.c | 12 |
3 files changed, 20 insertions, 19 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index fea0af0476b9..a962dcb9c408 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -67,7 +67,8 @@ struct acpi_cpufreq_data { | |||
67 | unsigned int cpu_feature; | 67 | unsigned int cpu_feature; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | static struct acpi_cpufreq_data *drv_data[NR_CPUS]; | 70 | static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data); |
71 | |||
71 | /* acpi_perf_data is a pointer to percpu data. */ | 72 | /* acpi_perf_data is a pointer to percpu data. */ |
72 | static struct acpi_processor_performance *acpi_perf_data; | 73 | static struct acpi_processor_performance *acpi_perf_data; |
73 | 74 | ||
@@ -218,14 +219,14 @@ static u32 get_cur_val(cpumask_t mask) | |||
218 | if (unlikely(cpus_empty(mask))) | 219 | if (unlikely(cpus_empty(mask))) |
219 | return 0; | 220 | return 0; |
220 | 221 | ||
221 | switch (drv_data[first_cpu(mask)]->cpu_feature) { | 222 | switch (per_cpu(drv_data, first_cpu(mask))->cpu_feature) { |
222 | case SYSTEM_INTEL_MSR_CAPABLE: | 223 | case SYSTEM_INTEL_MSR_CAPABLE: |
223 | cmd.type = SYSTEM_INTEL_MSR_CAPABLE; | 224 | cmd.type = SYSTEM_INTEL_MSR_CAPABLE; |
224 | cmd.addr.msr.reg = MSR_IA32_PERF_STATUS; | 225 | cmd.addr.msr.reg = MSR_IA32_PERF_STATUS; |
225 | break; | 226 | break; |
226 | case SYSTEM_IO_CAPABLE: | 227 | case SYSTEM_IO_CAPABLE: |
227 | cmd.type = SYSTEM_IO_CAPABLE; | 228 | cmd.type = SYSTEM_IO_CAPABLE; |
228 | perf = drv_data[first_cpu(mask)]->acpi_data; | 229 | perf = per_cpu(drv_data, first_cpu(mask))->acpi_data; |
229 | cmd.addr.io.port = perf->control_register.address; | 230 | cmd.addr.io.port = perf->control_register.address; |
230 | cmd.addr.io.bit_width = perf->control_register.bit_width; | 231 | cmd.addr.io.bit_width = perf->control_register.bit_width; |
231 | break; | 232 | break; |
@@ -325,7 +326,7 @@ static unsigned int get_measured_perf(unsigned int cpu) | |||
325 | 326 | ||
326 | #endif | 327 | #endif |
327 | 328 | ||
328 | retval = drv_data[cpu]->max_freq * perf_percent / 100; | 329 | retval = per_cpu(drv_data, cpu)->max_freq * perf_percent / 100; |
329 | 330 | ||
330 | put_cpu(); | 331 | put_cpu(); |
331 | set_cpus_allowed(current, saved_mask); | 332 | set_cpus_allowed(current, saved_mask); |
@@ -336,7 +337,7 @@ static unsigned int get_measured_perf(unsigned int cpu) | |||
336 | 337 | ||
337 | static unsigned int get_cur_freq_on_cpu(unsigned int cpu) | 338 | static unsigned int get_cur_freq_on_cpu(unsigned int cpu) |
338 | { | 339 | { |
339 | struct acpi_cpufreq_data *data = drv_data[cpu]; | 340 | struct acpi_cpufreq_data *data = per_cpu(drv_data, cpu); |
340 | unsigned int freq; | 341 | unsigned int freq; |
341 | 342 | ||
342 | dprintk("get_cur_freq_on_cpu (%d)\n", cpu); | 343 | dprintk("get_cur_freq_on_cpu (%d)\n", cpu); |
@@ -370,7 +371,7 @@ static unsigned int check_freqs(cpumask_t mask, unsigned int freq, | |||
370 | static int acpi_cpufreq_target(struct cpufreq_policy *policy, | 371 | static int acpi_cpufreq_target(struct cpufreq_policy *policy, |
371 | unsigned int target_freq, unsigned int relation) | 372 | unsigned int target_freq, unsigned int relation) |
372 | { | 373 | { |
373 | struct acpi_cpufreq_data *data = drv_data[policy->cpu]; | 374 | struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); |
374 | struct acpi_processor_performance *perf; | 375 | struct acpi_processor_performance *perf; |
375 | struct cpufreq_freqs freqs; | 376 | struct cpufreq_freqs freqs; |
376 | cpumask_t online_policy_cpus; | 377 | cpumask_t online_policy_cpus; |
@@ -466,7 +467,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy, | |||
466 | 467 | ||
467 | static int acpi_cpufreq_verify(struct cpufreq_policy *policy) | 468 | static int acpi_cpufreq_verify(struct cpufreq_policy *policy) |
468 | { | 469 | { |
469 | struct acpi_cpufreq_data *data = drv_data[policy->cpu]; | 470 | struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); |
470 | 471 | ||
471 | dprintk("acpi_cpufreq_verify\n"); | 472 | dprintk("acpi_cpufreq_verify\n"); |
472 | 473 | ||
@@ -570,7 +571,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
570 | return -ENOMEM; | 571 | return -ENOMEM; |
571 | 572 | ||
572 | data->acpi_data = percpu_ptr(acpi_perf_data, cpu); | 573 | data->acpi_data = percpu_ptr(acpi_perf_data, cpu); |
573 | drv_data[cpu] = data; | 574 | per_cpu(drv_data, cpu) = data; |
574 | 575 | ||
575 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) | 576 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) |
576 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; | 577 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; |
@@ -714,20 +715,20 @@ err_unreg: | |||
714 | acpi_processor_unregister_performance(perf, cpu); | 715 | acpi_processor_unregister_performance(perf, cpu); |
715 | err_free: | 716 | err_free: |
716 | kfree(data); | 717 | kfree(data); |
717 | drv_data[cpu] = NULL; | 718 | per_cpu(drv_data, cpu) = NULL; |
718 | 719 | ||
719 | return result; | 720 | return result; |
720 | } | 721 | } |
721 | 722 | ||
722 | static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) | 723 | static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) |
723 | { | 724 | { |
724 | struct acpi_cpufreq_data *data = drv_data[policy->cpu]; | 725 | struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); |
725 | 726 | ||
726 | dprintk("acpi_cpufreq_cpu_exit\n"); | 727 | dprintk("acpi_cpufreq_cpu_exit\n"); |
727 | 728 | ||
728 | if (data) { | 729 | if (data) { |
729 | cpufreq_frequency_table_put_attr(policy->cpu); | 730 | cpufreq_frequency_table_put_attr(policy->cpu); |
730 | drv_data[policy->cpu] = NULL; | 731 | per_cpu(drv_data, policy->cpu) = NULL; |
731 | acpi_processor_unregister_performance(data->acpi_data, | 732 | acpi_processor_unregister_performance(data->acpi_data, |
732 | policy->cpu); | 733 | policy->cpu); |
733 | kfree(data); | 734 | kfree(data); |
@@ -738,7 +739,7 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) | |||
738 | 739 | ||
739 | static int acpi_cpufreq_resume(struct cpufreq_policy *policy) | 740 | static int acpi_cpufreq_resume(struct cpufreq_policy *policy) |
740 | { | 741 | { |
741 | struct acpi_cpufreq_data *data = drv_data[policy->cpu]; | 742 | struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); |
742 | 743 | ||
743 | dprintk("acpi_cpufreq_resume\n"); | 744 | dprintk("acpi_cpufreq_resume\n"); |
744 | 745 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/longhaul.c b/arch/x86/kernel/cpu/cpufreq/longhaul.c index 749d00cb2ebd..06fcce516d51 100644 --- a/arch/x86/kernel/cpu/cpufreq/longhaul.c +++ b/arch/x86/kernel/cpu/cpufreq/longhaul.c | |||
@@ -694,7 +694,7 @@ static acpi_status longhaul_walk_callback(acpi_handle obj_handle, | |||
694 | if ( acpi_bus_get_device(obj_handle, &d) ) { | 694 | if ( acpi_bus_get_device(obj_handle, &d) ) { |
695 | return 0; | 695 | return 0; |
696 | } | 696 | } |
697 | *return_value = (void *)acpi_driver_data(d); | 697 | *return_value = acpi_driver_data(d); |
698 | return 1; | 698 | return 1; |
699 | } | 699 | } |
700 | 700 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c index 99e1ef9939be..a0522735dd9d 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -52,7 +52,7 @@ | |||
52 | /* serialize freq changes */ | 52 | /* serialize freq changes */ |
53 | static DEFINE_MUTEX(fidvid_mutex); | 53 | static DEFINE_MUTEX(fidvid_mutex); |
54 | 54 | ||
55 | static struct powernow_k8_data *powernow_data[NR_CPUS]; | 55 | static DEFINE_PER_CPU(struct powernow_k8_data *, powernow_data); |
56 | 56 | ||
57 | static int cpu_family = CPU_OPTERON; | 57 | static int cpu_family = CPU_OPTERON; |
58 | 58 | ||
@@ -1018,7 +1018,7 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned i | |||
1018 | static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsigned relation) | 1018 | static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsigned relation) |
1019 | { | 1019 | { |
1020 | cpumask_t oldmask = CPU_MASK_ALL; | 1020 | cpumask_t oldmask = CPU_MASK_ALL; |
1021 | struct powernow_k8_data *data = powernow_data[pol->cpu]; | 1021 | struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); |
1022 | u32 checkfid; | 1022 | u32 checkfid; |
1023 | u32 checkvid; | 1023 | u32 checkvid; |
1024 | unsigned int newstate; | 1024 | unsigned int newstate; |
@@ -1094,7 +1094,7 @@ err_out: | |||
1094 | /* Driver entry point to verify the policy and range of frequencies */ | 1094 | /* Driver entry point to verify the policy and range of frequencies */ |
1095 | static int powernowk8_verify(struct cpufreq_policy *pol) | 1095 | static int powernowk8_verify(struct cpufreq_policy *pol) |
1096 | { | 1096 | { |
1097 | struct powernow_k8_data *data = powernow_data[pol->cpu]; | 1097 | struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); |
1098 | 1098 | ||
1099 | if (!data) | 1099 | if (!data) |
1100 | return -EINVAL; | 1100 | return -EINVAL; |
@@ -1202,7 +1202,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1202 | dprintk("cpu_init done, current fid 0x%x, vid 0x%x\n", | 1202 | dprintk("cpu_init done, current fid 0x%x, vid 0x%x\n", |
1203 | data->currfid, data->currvid); | 1203 | data->currfid, data->currvid); |
1204 | 1204 | ||
1205 | powernow_data[pol->cpu] = data; | 1205 | per_cpu(powernow_data, pol->cpu) = data; |
1206 | 1206 | ||
1207 | return 0; | 1207 | return 0; |
1208 | 1208 | ||
@@ -1216,7 +1216,7 @@ err_out: | |||
1216 | 1216 | ||
1217 | static int __devexit powernowk8_cpu_exit (struct cpufreq_policy *pol) | 1217 | static int __devexit powernowk8_cpu_exit (struct cpufreq_policy *pol) |
1218 | { | 1218 | { |
1219 | struct powernow_k8_data *data = powernow_data[pol->cpu]; | 1219 | struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); |
1220 | 1220 | ||
1221 | if (!data) | 1221 | if (!data) |
1222 | return -EINVAL; | 1222 | return -EINVAL; |
@@ -1237,7 +1237,7 @@ static unsigned int powernowk8_get (unsigned int cpu) | |||
1237 | cpumask_t oldmask = current->cpus_allowed; | 1237 | cpumask_t oldmask = current->cpus_allowed; |
1238 | unsigned int khz = 0; | 1238 | unsigned int khz = 0; |
1239 | 1239 | ||
1240 | data = powernow_data[first_cpu(per_cpu(cpu_core_map, cpu))]; | 1240 | data = per_cpu(powernow_data, first_cpu(per_cpu(cpu_core_map, cpu))); |
1241 | 1241 | ||
1242 | if (!data) | 1242 | if (!data) |
1243 | return -EINVAL; | 1243 | return -EINVAL; |