aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2007-08-12 00:21:08 -0400
committerLen Brown <len.brown@intel.com>2007-08-12 00:21:08 -0400
commit27196c30db1ed4ab09c2071149b3324a1a53cfb9 (patch)
tree8d88ad2615b7b55cb7e0ebfc5fa15d992062d09a /arch
parentad17b209dca860a570e4ca75312c9f4d32672402 (diff)
parent501092929ccb8a1d2eb0ed700e38df4ae0de7108 (diff)
Pull processor into release branch
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index 32d04b083e3..705e13a3078 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -68,7 +68,8 @@ struct acpi_cpufreq_data {
};
static struct acpi_cpufreq_data *drv_data[NR_CPUS];
-static struct acpi_processor_performance *acpi_perf_data[NR_CPUS];
+/* acpi_perf_data is a pointer to percpu data. */
+static struct acpi_processor_performance *acpi_perf_data;
static struct cpufreq_driver acpi_cpufreq_driver;
@@ -508,24 +509,14 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
* do _PDC and _PSD and find out the processor dependency for the
* actual init that will happen later...
*/
-static int acpi_cpufreq_early_init(void)
+static int __init acpi_cpufreq_early_init(void)
{
- struct acpi_processor_performance *data;
- unsigned int i, j;
-
dprintk("acpi_cpufreq_early_init\n");
- for_each_possible_cpu(i) {
- data = kzalloc(sizeof(struct acpi_processor_performance),
- GFP_KERNEL);
- if (!data) {
- for_each_possible_cpu(j) {
- kfree(acpi_perf_data[j]);
- acpi_perf_data[j] = NULL;
- }
- return -ENOMEM;
- }
- acpi_perf_data[i] = data;
+ acpi_perf_data = alloc_percpu(struct acpi_processor_performance);
+ if (!acpi_perf_data) {
+ dprintk("Memory allocation error for acpi_perf_data.\n");
+ return -ENOMEM;
}
/* Do initialization in ACPI core */
@@ -574,14 +565,11 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
dprintk("acpi_cpufreq_cpu_init\n");
- if (!acpi_perf_data[cpu])
- return -ENODEV;
-
data = kzalloc(sizeof(struct acpi_cpufreq_data), GFP_KERNEL);
if (!data)
return -ENOMEM;
- data->acpi_data = acpi_perf_data[cpu];
+ data->acpi_data = percpu_ptr(acpi_perf_data, cpu);
drv_data[cpu] = data;
if (cpu_has(c, X86_FEATURE_CONSTANT_TSC))
@@ -778,24 +766,25 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
static int __init acpi_cpufreq_init(void)
{
+ int ret;
+
dprintk("acpi_cpufreq_init\n");
- acpi_cpufreq_early_init();
+ ret = acpi_cpufreq_early_init();
+ if (ret)
+ return ret;
return cpufreq_register_driver(&acpi_cpufreq_driver);
}
static void __exit acpi_cpufreq_exit(void)
{
- unsigned int i;
dprintk("acpi_cpufreq_exit\n");
cpufreq_unregister_driver(&acpi_cpufreq_driver);
- for_each_possible_cpu(i) {
- kfree(acpi_perf_data[i]);
- acpi_perf_data[i] = NULL;
- }
+ free_percpu(acpi_perf_data);
+
return;
}