]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/kernel/ibmebus.c
[POWERPC] Make ibmebus use of_(un)register_driver
[linux-2.6-omap-h63xx.git] / arch / powerpc / kernel / ibmebus.c
index 289d7e93591857bdbe3230a95fb08568b57df491..2f50bb5d00f936e6f55c4dc5c41b10b0182a9c19 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/kobject.h>
 #include <linux/dma-mapping.h>
 #include <linux/interrupt.h>
+#include <linux/of.h>
 #include <linux/of_platform.h>
 #include <asm/ibmebus.h>
 #include <asm/abs_addr.h>
@@ -52,7 +53,7 @@ static struct device ibmebus_bus_device = { /* fake "parent" device */
 struct bus_type ibmebus_bus_type;
 
 /* These devices will automatically be added to the bus during init */
-static struct of_device_id builtin_matches[] = {
+static struct of_device_id __initdata builtin_matches[] = {
        { .compatible = "IBM,lhca" },
        { .compatible = "IBM,lhea" },
        {},
@@ -102,8 +103,7 @@ static int ibmebus_map_sg(struct device *dev,
        int i;
 
        for_each_sg(sgl, sg, nents, i) {
-               sg->dma_address = (dma_addr_t)page_address(sg->page)
-                       + sg->offset;
+               sg->dma_address = (dma_addr_t) sg_virt(sg);
                sg->dma_length = sg->length;
        }
 
@@ -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;
 
@@ -198,16 +198,13 @@ int ibmebus_register_driver(struct of_platform_driver *drv)
        /* If the driver uses devices that ibmebus doesn't know, add them */
        ibmebus_create_devices(drv->match_table);
 
-       drv->driver.name   = drv->name;
-       drv->driver.bus    = &ibmebus_bus_type;
-
-       return driver_register(&drv->driver);
+       return of_register_driver(drv, &ibmebus_bus_type);
 }
 EXPORT_SYMBOL(ibmebus_register_driver);
 
 void ibmebus_unregister_driver(struct of_platform_driver *drv)
 {
-       driver_unregister(&drv->driver);
+       of_unregister_driver(drv);
 }
 EXPORT_SYMBOL(ibmebus_unregister_driver);