Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6
[safe/jmp/linux-2.6] / arch / powerpc / kernel / of_platform.c
index de36e23..666d08d 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>
 
@@ -75,6 +76,8 @@ struct of_device* of_platform_device_create(struct device_node *np,
                return NULL;
 
        dev->dma_mask = 0xffffffffUL;
+       dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+
        dev->dev.bus = &of_platform_bus_type;
 
        /* We do not fill the DMA ops for platform devices by default.
@@ -108,7 +111,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 +173,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;
 
@@ -211,7 +214,7 @@ EXPORT_SYMBOL(of_find_device_by_node);
 static int of_dev_phandle_match(struct device *dev, void *data)
 {
        phandle *ph = data;
-       return to_of_device(dev)->node->linux_phandle == *ph;
+       return to_of_device(dev)->node->phandle == *ph;
 }
 
 struct of_device *of_find_device_by_phandle(phandle ph)
@@ -273,7 +276,9 @@ static int __devinit of_pci_phb_probe(struct of_device *dev,
 #endif /* CONFIG_EEH */
 
        /* Scan the bus */
-       scan_phb(phb);
+       pcibios_scan_phb(phb, dev->node);
+       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