of: Always use 'struct device.of_node' to get device node pointer.
[safe/jmp/linux-2.6] / drivers / serial / apbuart.c
index c7883a3..52015d7 100644 (file)
 #include <linux/device.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/serial_core.h>
 #include <asm/irq.h>
-#include <asm/oplib.h>
 
 #include "apbuart.h"
 
@@ -559,7 +559,7 @@ static int __devinit apbuart_probe(struct of_device *op,
 
        i = 0;
        for (i = 0; i < grlib_apbuart_port_nr; i++) {
-               if (op->node == grlib_apbuart_nodes[i])
+               if (op->dev.of_node == grlib_apbuart_nodes[i])
                        break;
        }
 
@@ -596,10 +596,9 @@ static struct of_platform_driver grlib_apbuart_of_driver = {
 static void grlib_apbuart_configure(void)
 {
        static int enum_done;
-       struct device_node *np;
+       struct device_node *np, *rp;
        struct uart_port *port = NULL;
-
-       int node;
+       const u32 *prop;
        int freq_khz;
        int v = 0, d = 0;
        unsigned int addr;
@@ -610,8 +609,10 @@ static void grlib_apbuart_configure(void)
                return;
 
        /* Get bus frequency */
-       node = prom_getchild(prom_root_node);
-       freq_khz = prom_getint(node, "clock-frequency");
+       rp = of_find_node_by_path("/");
+       rp = of_get_next_child(rp, NULL);
+       prop = of_get_property(rp, "clock-frequency", NULL);
+       freq_khz = *prop;
 
        line = 0;
        for_each_matching_node(np, apbuart_match) {
@@ -676,8 +677,7 @@ static int __init grlib_apbuart_init(void)
                return ret;
        }
 
-       ret = of_register_driver(&grlib_apbuart_of_driver, &of_platform_bus_type);
-
+       ret = of_register_platform_driver(&grlib_apbuart_of_driver);
        if (ret) {
                printk(KERN_ERR
                       "%s: of_register_platform_driver failed (%i)\n",
@@ -698,7 +698,7 @@ static void __exit grlib_apbuart_exit(void)
                                     &grlib_apbuart_ports[i]);
 
        uart_unregister_driver(&grlib_apbuart_driver);
-
+       of_unregister_platform_driver(&grlib_apbuart_of_driver);
 }
 
 module_init(grlib_apbuart_init);