aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 16:28:20 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 16:28:20 -0500
commitdad2ad82c5f058367df79de022bd12d36afcd065 (patch)
tree426a1a6ca8762356b375527768bedc2de0bd25e9 /arch/i386
parent7079060f3e86ea4c1d4e9c1e356592ef9dcaaa1f (diff)
parentb7fb358c7c36a14927d5523ea674e69f90c51d1d (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
Diffstat (limited to 'arch/i386')
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c3
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k7.c12
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c19
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c3
4 files changed, 8 insertions, 29 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index caa9f7711343..871366b83b3f 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -377,10 +377,9 @@ acpi_cpufreq_cpu_init (
377 arg0.buffer.length = 12; 377 arg0.buffer.length = 12;
378 arg0.buffer.pointer = (u8 *) arg0_buf; 378 arg0.buffer.pointer = (u8 *) arg0_buf;
379 379
380 data = kmalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); 380 data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);
381 if (!data) 381 if (!data)
382 return (-ENOMEM); 382 return (-ENOMEM);
383 memset(data, 0, sizeof(struct cpufreq_acpi_io));
384 383
385 acpi_io_data[cpu] = data; 384 acpi_io_data[cpu] = data;
386 385
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
index 73a5dc5b26b8..edcd626001da 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
@@ -171,10 +171,9 @@ static int get_ranges (unsigned char *pst)
171 unsigned int speed; 171 unsigned int speed;
172 u8 fid, vid; 172 u8 fid, vid;
173 173
174 powernow_table = kmalloc((sizeof(struct cpufreq_frequency_table) * (number_scales + 1)), GFP_KERNEL); 174 powernow_table = kzalloc((sizeof(struct cpufreq_frequency_table) * (number_scales + 1)), GFP_KERNEL);
175 if (!powernow_table) 175 if (!powernow_table)
176 return -ENOMEM; 176 return -ENOMEM;
177 memset(powernow_table, 0, (sizeof(struct cpufreq_frequency_table) * (number_scales + 1)));
178 177
179 for (j=0 ; j < number_scales; j++) { 178 for (j=0 ; j < number_scales; j++) {
180 fid = *pst++; 179 fid = *pst++;
@@ -305,16 +304,13 @@ static int powernow_acpi_init(void)
305 goto err0; 304 goto err0;
306 } 305 }
307 306
308 acpi_processor_perf = kmalloc(sizeof(struct acpi_processor_performance), 307 acpi_processor_perf = kzalloc(sizeof(struct acpi_processor_performance),
309 GFP_KERNEL); 308 GFP_KERNEL);
310
311 if (!acpi_processor_perf) { 309 if (!acpi_processor_perf) {
312 retval = -ENOMEM; 310 retval = -ENOMEM;
313 goto err0; 311 goto err0;
314 } 312 }
315 313
316 memset(acpi_processor_perf, 0, sizeof(struct acpi_processor_performance));
317
318 if (acpi_processor_register_performance(acpi_processor_perf, 0)) { 314 if (acpi_processor_register_performance(acpi_processor_perf, 0)) {
319 retval = -EIO; 315 retval = -EIO;
320 goto err1; 316 goto err1;
@@ -337,14 +333,12 @@ static int powernow_acpi_init(void)
337 goto err2; 333 goto err2;
338 } 334 }
339 335
340 powernow_table = kmalloc((number_scales + 1) * (sizeof(struct cpufreq_frequency_table)), GFP_KERNEL); 336 powernow_table = kzalloc((number_scales + 1) * (sizeof(struct cpufreq_frequency_table)), GFP_KERNEL);
341 if (!powernow_table) { 337 if (!powernow_table) {
342 retval = -ENOMEM; 338 retval = -ENOMEM;
343 goto err2; 339 goto err2;
344 } 340 }
345 341
346 memset(powernow_table, 0, ((number_scales + 1) * sizeof(struct cpufreq_frequency_table)));
347
348 pc.val = (unsigned long) acpi_processor_perf->states[0].control; 342 pc.val = (unsigned long) acpi_processor_perf->states[0].control;
349 for (i = 0; i < number_scales; i++) { 343 for (i = 0; i < number_scales; i++) {
350 u8 fid, vid; 344 u8 fid, vid;
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
index 2d5c9adba0cd..68a1fc87f4ca 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -462,7 +462,6 @@ static int check_supported_cpu(unsigned int cpu)
462 462
463 oldmask = current->cpus_allowed; 463 oldmask = current->cpus_allowed;
464 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 464 set_cpus_allowed(current, cpumask_of_cpu(cpu));
465 schedule();
466 465
467 if (smp_processor_id() != cpu) { 466 if (smp_processor_id() != cpu) {
468 printk(KERN_ERR "limiting to cpu %u failed\n", cpu); 467 printk(KERN_ERR "limiting to cpu %u failed\n", cpu);
@@ -497,9 +496,7 @@ static int check_supported_cpu(unsigned int cpu)
497 496
498out: 497out:
499 set_cpus_allowed(current, oldmask); 498 set_cpus_allowed(current, oldmask);
500 schedule();
501 return rc; 499 return rc;
502
503} 500}
504 501
505static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8 maxvid) 502static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8 maxvid)
@@ -913,7 +910,6 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
913 /* only run on specific CPU from here on */ 910 /* only run on specific CPU from here on */
914 oldmask = current->cpus_allowed; 911 oldmask = current->cpus_allowed;
915 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); 912 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
916 schedule();
917 913
918 if (smp_processor_id() != pol->cpu) { 914 if (smp_processor_id() != pol->cpu) {
919 printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); 915 printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu);
@@ -968,8 +964,6 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
968 964
969err_out: 965err_out:
970 set_cpus_allowed(current, oldmask); 966 set_cpus_allowed(current, oldmask);
971 schedule();
972
973 return ret; 967 return ret;
974} 968}
975 969
@@ -991,12 +985,11 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol)
991 if (!check_supported_cpu(pol->cpu)) 985 if (!check_supported_cpu(pol->cpu))
992 return -ENODEV; 986 return -ENODEV;
993 987
994 data = kmalloc(sizeof(struct powernow_k8_data), GFP_KERNEL); 988 data = kzalloc(sizeof(struct powernow_k8_data), GFP_KERNEL);
995 if (!data) { 989 if (!data) {
996 printk(KERN_ERR PFX "unable to alloc powernow_k8_data"); 990 printk(KERN_ERR PFX "unable to alloc powernow_k8_data");
997 return -ENOMEM; 991 return -ENOMEM;
998 } 992 }
999 memset(data,0,sizeof(struct powernow_k8_data));
1000 993
1001 data->cpu = pol->cpu; 994 data->cpu = pol->cpu;
1002 995
@@ -1026,7 +1019,6 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol)
1026 /* only run on specific CPU from here on */ 1019 /* only run on specific CPU from here on */
1027 oldmask = current->cpus_allowed; 1020 oldmask = current->cpus_allowed;
1028 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); 1021 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
1029 schedule();
1030 1022
1031 if (smp_processor_id() != pol->cpu) { 1023 if (smp_processor_id() != pol->cpu) {
1032 printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); 1024 printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu);
@@ -1045,7 +1037,6 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol)
1045 1037
1046 /* run on any CPU again */ 1038 /* run on any CPU again */
1047 set_cpus_allowed(current, oldmask); 1039 set_cpus_allowed(current, oldmask);
1048 schedule();
1049 1040
1050 pol->governor = CPUFREQ_DEFAULT_GOVERNOR; 1041 pol->governor = CPUFREQ_DEFAULT_GOVERNOR;
1051 pol->cpus = cpu_core_map[pol->cpu]; 1042 pol->cpus = cpu_core_map[pol->cpu];
@@ -1080,7 +1071,6 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol)
1080 1071
1081err_out: 1072err_out:
1082 set_cpus_allowed(current, oldmask); 1073 set_cpus_allowed(current, oldmask);
1083 schedule();
1084 powernow_k8_cpu_exit_acpi(data); 1074 powernow_k8_cpu_exit_acpi(data);
1085 1075
1086 kfree(data); 1076 kfree(data);
@@ -1116,17 +1106,14 @@ static unsigned int powernowk8_get (unsigned int cpu)
1116 set_cpus_allowed(current, oldmask); 1106 set_cpus_allowed(current, oldmask);
1117 return 0; 1107 return 0;
1118 } 1108 }
1119 preempt_disable(); 1109
1120
1121 if (query_current_values_with_pending_wait(data)) 1110 if (query_current_values_with_pending_wait(data))
1122 goto out; 1111 goto out;
1123 1112
1124 khz = find_khz_freq_from_fid(data->currfid); 1113 khz = find_khz_freq_from_fid(data->currfid);
1125 1114
1126 out: 1115out:
1127 preempt_enable_no_resched();
1128 set_cpus_allowed(current, oldmask); 1116 set_cpus_allowed(current, oldmask);
1129
1130 return khz; 1117 return khz;
1131} 1118}
1132 1119
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index 0ea010a7afb1..edb9873e27e3 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -423,12 +423,11 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
423 } 423 }
424 } 424 }
425 425
426 centrino_model[cpu] = kmalloc(sizeof(struct cpu_model), GFP_KERNEL); 426 centrino_model[cpu] = kzalloc(sizeof(struct cpu_model), GFP_KERNEL);
427 if (!centrino_model[cpu]) { 427 if (!centrino_model[cpu]) {
428 result = -ENOMEM; 428 result = -ENOMEM;
429 goto err_unreg; 429 goto err_unreg;
430 } 430 }
431 memset(centrino_model[cpu], 0, sizeof(struct cpu_model));
432 431
433 centrino_model[cpu]->model_name=NULL; 432 centrino_model[cpu]->model_name=NULL;
434 centrino_model[cpu]->max_freq = p.states[0].core_frequency * 1000; 433 centrino_model[cpu]->max_freq = p.states[0].core_frequency * 1000;