Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[pandora-kernel.git] / arch / powerpc / kernel / of_platform.c
index de36e23..e79ad8a 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/mod_devicetable.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
+#include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_platform.h>
 
@@ -108,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)
@@ -170,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;
 
@@ -274,6 +275,8 @@ static int __devinit of_pci_phb_probe(struct of_device *dev,
 
        /* Scan the bus */
        scan_phb(phb);
+       if (phb->bus == NULL)
+               return -ENXIO;
 
        /* Claim resources. This might need some rework as well depending
         * wether we are doing probe-only or not, like assigning unassigned