aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2011-08-10 16:44:22 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-09-20 01:53:23 -0400
commit94db7c5e14f44b943febe54e089d077cd983d284 (patch)
tree1dc71fe4ee73a58209c3a60bcd3913fae25c463b /arch/powerpc
parent6083184269fd723affca4f6340e491950267622a (diff)
powerpc: Use for_each_node_by_type instead of open coding it
Use for_each_node_by_type instead of open coding it. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c3
-rw-r--r--arch/powerpc/kernel/setup_64.c2
-rw-r--r--arch/powerpc/mm/numa.c10
3 files changed, 7 insertions, 8 deletions
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 583af70c4b14..26ccbf77dd41 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -74,8 +74,7 @@ int default_machine_kexec_prepare(struct kimage *image)
74 } 74 }
75 75
76 /* We also should not overwrite the tce tables */ 76 /* We also should not overwrite the tce tables */
77 for (node = of_find_node_by_type(NULL, "pci"); node != NULL; 77 for_each_node_by_type(node, "pci") {
78 node = of_find_node_by_type(node, "pci")) {
79 basep = of_get_property(node, "linux,tce-base", NULL); 78 basep = of_get_property(node, "linux,tce-base", NULL);
80 sizep = of_get_property(node, "linux,tce-size", NULL); 79 sizep = of_get_property(node, "linux,tce-size", NULL);
81 if (basep == NULL || sizep == NULL) 80 if (basep == NULL || sizep == NULL)
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index aebef1320ed7..eade1fd8ee2e 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -278,7 +278,7 @@ static void __init initialize_cache_info(void)
278 278
279 DBG(" -> initialize_cache_info()\n"); 279 DBG(" -> initialize_cache_info()\n");
280 280
281 for (np = NULL; (np = of_find_node_by_type(np, "cpu"));) { 281 for_each_node_by_type(np, "cpu") {
282 num_cpus += 1; 282 num_cpus += 1;
283 283
284 /* We're assuming *all* of the CPUs have the same 284 /* We're assuming *all* of the CPUs have the same
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 2c1ae7a5fb53..00cc090cd1dc 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -710,7 +710,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
710static int __init parse_numa_properties(void) 710static int __init parse_numa_properties(void)
711{ 711{
712 struct device_node *cpu = NULL; 712 struct device_node *cpu = NULL;
713 struct device_node *memory = NULL; 713 struct device_node *memory;
714 int default_nid = 0; 714 int default_nid = 0;
715 unsigned long i; 715 unsigned long i;
716 716
@@ -750,8 +750,8 @@ static int __init parse_numa_properties(void)
750 } 750 }
751 751
752 get_n_mem_cells(&n_mem_addr_cells, &n_mem_size_cells); 752 get_n_mem_cells(&n_mem_addr_cells, &n_mem_size_cells);
753 memory = NULL; 753
754 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { 754 for_each_node_by_type(memory, "memory") {
755 unsigned long start; 755 unsigned long start;
756 unsigned long size; 756 unsigned long size;
757 int nid; 757 int nid;
@@ -1187,10 +1187,10 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
1187 */ 1187 */
1188int hot_add_node_scn_to_nid(unsigned long scn_addr) 1188int hot_add_node_scn_to_nid(unsigned long scn_addr)
1189{ 1189{
1190 struct device_node *memory = NULL; 1190 struct device_node *memory;
1191 int nid = -1; 1191 int nid = -1;
1192 1192
1193 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { 1193 for_each_node_by_type(memory, "memory") {
1194 unsigned long start, size; 1194 unsigned long start, size;
1195 int ranges; 1195 int ranges;
1196 const unsigned int *memcell_buf; 1196 const unsigned int *memcell_buf;