[POWERPC] arch/powerpc/kernel: Use for_each_child_of_node
authorStephen Rothwell <sfr@canb.auug.org.au>
Thu, 3 Jan 2008 04:13:37 +0000 (15:13 +1100)
committerPaul Mackerras <paulus@samba.org>
Thu, 17 Jan 2008 03:57:20 +0000 (14:57 +1100)
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/ibmebus.c
arch/powerpc/kernel/of_platform.c
arch/powerpc/kernel/pci_32.c
arch/powerpc/kernel/pci_64.c
arch/powerpc/kernel/rtas_pci.c

index 3b708449f731a80cfd156e7b13a3c61a3a052369..fd5ae8d17c96e2d586c03e75f8e6f6d520283629 100644 (file)
@@ -172,7 +172,7 @@ static int ibmebus_create_devices(const struct of_device_id *matches)
 
        root = of_find_node_by_path("/");
 
-       for (child = NULL; (child = of_get_next_child(root, child)); ) {
+       for_each_child_of_node(root, child) {
                if (!of_match_node(matches, child))
                        continue;
 
index 7a3cafbe8af98419fd1cd15ade58fedd516d792a..fb698d47082d3d10c17edcdff354ce4f832858b6 100644 (file)
@@ -109,7 +109,7 @@ static int of_platform_bus_create(const struct device_node *bus,
        struct of_device *dev;
        int rc = 0;
 
-       for (child = NULL; (child = of_get_next_child(bus, child)); ) {
+       for_each_child_of_node(bus, child) {
                pr_debug("   create child: %s\n", child->full_name);
                dev = of_platform_device_create(child, NULL, parent);
                if (dev == NULL)
@@ -171,7 +171,7 @@ int of_platform_bus_probe(struct device_node *root,
                rc = of_platform_bus_create(root, matches, &dev->dev);
                goto bail;
        }
-       for (child = NULL; (child = of_get_next_child(root, child)); ) {
+       for_each_child_of_node(root, child) {
                if (!of_match_node(matches, child))
                        continue;
 
index 47dc754465bb6f0e808e17b0cbc704248c2f18f7..14e300f85ce4857478c84acd6c5d6eefd59516aa 100644 (file)
@@ -276,11 +276,11 @@ scan_OF_pci_childs(struct device_node *parent, pci_OF_scan_iterator filter, void
 static struct device_node *scan_OF_for_pci_dev(struct device_node *parent,
                                               unsigned int devfn)
 {
-       struct device_node *np = NULL;
+       struct device_node *np;
        const u32 *reg;
        unsigned int psize;
 
-       while ((np = of_get_next_child(parent, np)) != NULL) {
+       for_each_child_of_node(parent, np) {
                reg = of_get_property(np, "reg", &psize);
                if (reg == NULL || psize < 4)
                        continue;
index 5949bbabd7fb7620316d57b08ec012bef9f89a28..1930f393d01c9275a87025f0fcd0f76a5dcdec5b 100644 (file)
@@ -227,7 +227,7 @@ EXPORT_SYMBOL(of_create_pci_dev);
 void __devinit of_scan_bus(struct device_node *node,
                           struct pci_bus *bus)
 {
-       struct device_node *child = NULL;
+       struct device_node *child;
        const u32 *reg;
        int reglen, devfn;
        struct pci_dev *dev;
@@ -235,7 +235,7 @@ void __devinit of_scan_bus(struct device_node *node,
        DBG("of_scan_bus(%s) bus no %d... \n", node->full_name, bus->number);
 
        /* Scan direct children */
-       while ((child = of_get_next_child(node, child)) != NULL) {
+       for_each_child_of_node(node, child) {
                DBG("  * %s\n", child->full_name);
                reg = of_get_property(child, "reg", &reglen);
                if (reg == NULL || reglen < 20)
index 99aaae3409c0bf2b5148165c4d41f69fa00ae2df..433a0a0949fb2341b61384d553520e19fcdf4a38 100644 (file)
@@ -280,10 +280,7 @@ void __init find_and_init_phbs(void)
        struct pci_controller *phb;
        struct device_node *root = of_find_node_by_path("/");
 
-       for (node = of_get_next_child(root, NULL);
-            node != NULL;
-            node = of_get_next_child(root, node)) {
-
+       for_each_child_of_node(root, node) {
                if (node->type == NULL || (strcmp(node->type, "pci") != 0 &&
                                           strcmp(node->type, "pciex") != 0))
                        continue;