powerpc: Use for_each_node_by_type instead of open coding it
authorAnton Blanchard <anton@samba.org>
Wed, 10 Aug 2011 20:44:22 +0000 (20:44 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 20 Sep 2011 05:53:23 +0000 (15:53 +1000)
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>
arch/powerpc/kernel/machine_kexec_64.c
arch/powerpc/kernel/setup_64.c
arch/powerpc/mm/numa.c

index 583af70c4b144a47dbe06549b3df409fe46a27cf..26ccbf77dd4124958f83808b002e3a0176b3f6d4 100644 (file)
@@ -74,8 +74,7 @@ int default_machine_kexec_prepare(struct kimage *image)
        }
 
        /* We also should not overwrite the tce tables */
-       for (node = of_find_node_by_type(NULL, "pci"); node != NULL;
-                       node = of_find_node_by_type(node, "pci")) {
+       for_each_node_by_type(node, "pci") {
                basep = of_get_property(node, "linux,tce-base", NULL);
                sizep = of_get_property(node, "linux,tce-size", NULL);
                if (basep == NULL || sizep == NULL)
index aebef1320ed737b75437c920d9e233cfcf4ea0ae..eade1fd8ee2ecac24a2a2403898236e000a6f64e 100644 (file)
@@ -278,7 +278,7 @@ static void __init initialize_cache_info(void)
 
        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;
 
                /* We're assuming *all* of the CPUs have the same
index 2c1ae7a5fb53c79ee09eff79f6a94e07f2cf7f53..00cc090cd1dc1365a8c3ccaf9ca403c36a958836 100644 (file)
@@ -710,7 +710,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
 static int __init parse_numa_properties(void)
 {
        struct device_node *cpu = NULL;
-       struct device_node *memory = NULL;
+       struct device_node *memory;
        int default_nid = 0;
        unsigned long i;
 
@@ -750,8 +750,8 @@ static int __init parse_numa_properties(void)
        }
 
        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 size;
                int nid;
@@ -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)
 {
-       struct device_node *memory = NULL;
+       struct device_node *memory;
        int nid = -1;
 
-       while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
+       for_each_node_by_type(memory, "memory") {
                unsigned long start, size;
                int ranges;
                const unsigned int *memcell_buf;