[patch 08/16] for_each_possible_cpu: under drivers/acpi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>

for_each_cpu() actually iterates across all possible CPUs.  We've had mistakes
in the past where people were using for_each_cpu() where they should have been
iterating across only online or present CPUs.  This is inefficient and
possibly buggy.

We're renaming for_each_cpu() to for_each_possible_cpu() to avoid this in the
future.

This patch replaces for_each_cpu with for_each_possible_cpu.
under drivers/acpi/

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/acpi/processor_perflib.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff -puN drivers/acpi/processor_perflib.c~for_each_possible_cpu-under-drivers-acpi drivers/acpi/processor_perflib.c
--- devel/drivers/acpi/processor_perflib.c~for_each_possible_cpu-under-drivers-acpi	2006-04-10 23:16:23.000000000 -0700
+++ devel-akpm/drivers/acpi/processor_perflib.c	2006-04-10 23:16:23.000000000 -0700
@@ -626,7 +626,7 @@ int acpi_processor_preregister_performan
 	retval = 0;
 
 	/* Call _PSD for all CPUs */
-	for_each_cpu(i) {
+	for_each_possible_cpu(i) {
 		pr = processors[i];
 		if (!pr) {
 			/* Look only at processors in ACPI namespace */
@@ -657,7 +657,7 @@ int acpi_processor_preregister_performan
 	 * Now that we have _PSD data from all CPUs, lets setup P-state 
 	 * domain info.
 	 */
-	for_each_cpu(i) {
+	for_each_possible_cpu(i) {
 		pr = processors[i];
 		if (!pr)
 			continue;
@@ -678,7 +678,7 @@ int acpi_processor_preregister_performan
 	}
 
 	cpus_clear(covered_cpus);
-	for_each_cpu(i) {
+	for_each_possible_cpu(i) {
 		pr = processors[i];
 		if (!pr)
 			continue;
@@ -702,7 +702,7 @@ int acpi_processor_preregister_performan
 			pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ANY;
 		}
 
-		for_each_cpu(j) {
+		for_each_possible_cpu(j) {
 			if (i == j)
 				continue;
 
@@ -731,7 +731,7 @@ int acpi_processor_preregister_performan
 			count++;
 		}
 
-		for_each_cpu(j) {
+		for_each_possible_cpu(j) {
 			if (i == j)
 				continue;
 
@@ -755,7 +755,7 @@ err_ret:
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error while parsing _PSD domain information. Assuming no coordination\n"));
 	}
 
-	for_each_cpu(i) {
+	for_each_possible_cpu(i) {
 		pr = processors[i];
 		if (!pr || !pr->performance)
 			continue;
_
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux