Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[pandora-kernel.git] / drivers / char / vc_screen.c
index 83aeedd..c2ae52d 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/kbd_kern.h>
 #include <linux/console.h>
 #include <linux/device.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 #include <asm/byteorder.h>
@@ -460,9 +461,13 @@ static int
 vcs_open(struct inode *inode, struct file *filp)
 {
        unsigned int currcons = iminor(inode) & 127;
+       int ret = 0;
+       
+       lock_kernel();
        if(currcons && !vc_cons_allocated(currcons-1))
-               return -ENXIO;
-       return 0;
+               ret = -ENXIO;
+       unlock_kernel();
+       return ret;
 }
 
 static const struct file_operations vcs_fops = {
@@ -476,10 +481,10 @@ static struct class *vc_class;
 
 void vcs_make_sysfs(struct tty_struct *tty)
 {
-       device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1),
-                       "vcs%u", tty->index + 1);
-       device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129),
-                       "vcsa%u", tty->index + 1);
+       device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1),
+                             NULL, "vcs%u", tty->index + 1);
+       device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129),
+                             NULL, "vcsa%u", tty->index + 1);
 }
 
 void vcs_remove_sysfs(struct tty_struct *tty)
@@ -494,7 +499,7 @@ int __init vcs_init(void)
                panic("unable to get major %d for vcs device", VCS_MAJOR);
        vc_class = class_create(THIS_MODULE, "vc");
 
-       device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), "vcs");
-       device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), "vcsa");
+       device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs");
+       device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa");
        return 0;
 }