Commit 94db7c5e authored by Anton Blanchard's avatar Anton Blanchard Committed by Benjamin Herrenschmidt

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: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 60831842
...@@ -74,8 +74,7 @@ int default_machine_kexec_prepare(struct kimage *image) ...@@ -74,8 +74,7 @@ int default_machine_kexec_prepare(struct kimage *image)
} }
/* We also should not overwrite the tce tables */ /* We also should not overwrite the tce tables */
for (node = of_find_node_by_type(NULL, "pci"); node != NULL; for_each_node_by_type(node, "pci") {
node = of_find_node_by_type(node, "pci")) {
basep = of_get_property(node, "linux,tce-base", NULL); basep = of_get_property(node, "linux,tce-base", NULL);
sizep = of_get_property(node, "linux,tce-size", NULL); sizep = of_get_property(node, "linux,tce-size", NULL);
if (basep == NULL || sizep == NULL) if (basep == NULL || sizep == NULL)
......
...@@ -278,7 +278,7 @@ static void __init initialize_cache_info(void) ...@@ -278,7 +278,7 @@ static void __init initialize_cache_info(void)
DBG(" -> initialize_cache_info()\n"); DBG(" -> initialize_cache_info()\n");
for (np = NULL; (np = of_find_node_by_type(np, "cpu"));) { for_each_node_by_type(np, "cpu") {
num_cpus += 1; num_cpus += 1;
/* We're assuming *all* of the CPUs have the same /* We're assuming *all* of the CPUs have the same
......
...@@ -710,7 +710,7 @@ static void __init parse_drconf_memory(struct device_node *memory) ...@@ -710,7 +710,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
static int __init parse_numa_properties(void) static int __init parse_numa_properties(void)
{ {
struct device_node *cpu = NULL; struct device_node *cpu = NULL;
struct device_node *memory = NULL; struct device_node *memory;
int default_nid = 0; int default_nid = 0;
unsigned long i; unsigned long i;
...@@ -750,8 +750,8 @@ static int __init parse_numa_properties(void) ...@@ -750,8 +750,8 @@ static int __init parse_numa_properties(void)
} }
get_n_mem_cells(&n_mem_addr_cells, &n_mem_size_cells); get_n_mem_cells(&n_mem_addr_cells, &n_mem_size_cells);
memory = NULL;
while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { for_each_node_by_type(memory, "memory") {
unsigned long start; unsigned long start;
unsigned long size; unsigned long size;
int nid; int nid;
...@@ -1187,10 +1187,10 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory, ...@@ -1187,10 +1187,10 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
*/ */
int hot_add_node_scn_to_nid(unsigned long scn_addr) int hot_add_node_scn_to_nid(unsigned long scn_addr)
{ {
struct device_node *memory = NULL; struct device_node *memory;
int nid = -1; int nid = -1;
while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { for_each_node_by_type(memory, "memory") {
unsigned long start, size; unsigned long start, size;
int ranges; int ranges;
const unsigned int *memcell_buf; const unsigned int *memcell_buf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment