Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
[safe/jmp/linux-2.6] / drivers / macintosh / ans-lcd.c
index 5e0811d..6a82218 100644 (file)
@@ -3,6 +3,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/smp_lock.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/miscdevice.h>
 #include <asm/uaccess.h>
 #include <asm/sections.h>
 #include <asm/prom.h>
-#include <asm/ans-lcd.h>
 #include <asm/io.h>
 
+#include "ans-lcd.h"
+
 #define ANSLCD_ADDR            0xf301c000
 #define ANSLCD_CTRL_IX 0x00
 #define ANSLCD_DATA_IX 0x10
@@ -27,7 +29,7 @@ static volatile unsigned char __iomem *anslcd_ptr;
 
 #undef DEBUG
 
-static void __pmac
+static void
 anslcd_write_byte_ctrl ( unsigned char c )
 {
 #ifdef DEBUG
@@ -43,14 +45,14 @@ anslcd_write_byte_ctrl ( unsigned char c )
        }
 }
 
-static void __pmac
+static void
 anslcd_write_byte_data ( unsigned char c )
 {
        out_8(anslcd_ptr + ANSLCD_DATA_IX, c);
        udelay(anslcd_short_delay);
 }
 
-static ssize_t __pmac
+static ssize_t
 anslcd_write( struct file * file, const char __user * buf, 
                                size_t count, loff_t *ppos )
 {
@@ -73,7 +75,7 @@ anslcd_write( struct file * file, const char __user * buf,
        return p - buf;
 }
 
-static int __pmac
+static int
 anslcd_ioctl( struct inode * inode, struct file * file,
                                unsigned int cmd, unsigned long arg )
 {
@@ -115,13 +117,14 @@ anslcd_ioctl( struct inode * inode, struct file * file,
        }
 }
 
-static int __pmac
+static int
 anslcd_open( struct inode * inode, struct file * file )
 {
+       cycle_kernel_lock();
        return 0;
 }
 
-struct file_operations anslcd_fops = {
+const struct file_operations anslcd_fops = {
        .write  = anslcd_write,
        .ioctl  = anslcd_ioctl,
        .open   = anslcd_open,
@@ -145,11 +148,12 @@ anslcd_init(void)
        int retval;
        struct device_node* node;
 
-       node = find_devices("lcd");
-       if (!node || !node->parent)
-               return -ENODEV;
-       if (strcmp(node->parent->name, "gc"))
+       node = of_find_node_by_name(NULL, "lcd");
+       if (!node || !node->parent || strcmp(node->parent->name, "gc")) {
+               of_node_put(node);
                return -ENODEV;
+       }
+       of_node_put(node);
 
        anslcd_ptr = ioremap(ANSLCD_ADDR, 0x20);