]> err.no Git - linux-2.6/blobdiff - arch/powerpc/kernel/of_platform.c
[POWERPC] Fix bootwrapper builds with newer gcc versions
[linux-2.6] / arch / powerpc / kernel / of_platform.c
index 79c04d151ddbf52631199d0aa0baa328afed1d73..e79ad8afda0737fed27aa043fa8ca726b8a5411a 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>
 
@@ -40,7 +41,7 @@
  * a bus type in the list
  */
 
-static struct of_device_id of_default_bus_ids[] = {
+static const struct of_device_id of_default_bus_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
        { .type = "spider", },
@@ -100,15 +101,15 @@ EXPORT_SYMBOL(of_platform_device_create);
  * @matches: match table, NULL to use the default, OF_NO_DEEP_PROBE to
  * disallow recursive creation of child busses
  */
-static int of_platform_bus_create(struct device_node *bus,
-                                 struct of_device_id *matches,
+static int of_platform_bus_create(const struct device_node *bus,
+                                 const struct of_device_id *matches,
                                  struct device *parent)
 {
        struct device_node *child;
        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)
@@ -137,7 +138,7 @@ static int of_platform_bus_create(struct device_node *bus,
  */
 
 int of_platform_bus_probe(struct device_node *root,
-                         struct of_device_id *matches,
+                         const struct of_device_id *matches,
                          struct device *parent)
 {
        struct device_node *child;
@@ -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