Merge branch 'linus' into cpus4096
[pandora-kernel.git] / drivers / char / raw.c
index 645e20a..505fcbe 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/cdev.h>
 #include <linux/device.h>
 #include <linux/mutex.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 
@@ -53,6 +54,7 @@ static int raw_open(struct inode *inode, struct file *filp)
                return 0;
        }
 
+       lock_kernel();
        mutex_lock(&raw_mutex);
 
        /*
@@ -79,6 +81,7 @@ static int raw_open(struct inode *inode, struct file *filp)
                        bdev->bd_inode->i_mapping;
        filp->private_data = bdev;
        mutex_unlock(&raw_mutex);
+       unlock_kernel();
        return 0;
 
 out2:
@@ -154,7 +157,7 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp,
                        goto out;
                }
 
-               if (rq.raw_minor < 0 || rq.raw_minor >= MAX_RAW_MINORS) {
+               if (rq.raw_minor <= 0 || rq.raw_minor >= MAX_RAW_MINORS) {
                        err = -EINVAL;
                        goto out;
                }
@@ -255,10 +258,7 @@ static const struct file_operations raw_ctl_fops = {
        .owner  =       THIS_MODULE,
 };
 
-static struct cdev raw_cdev = {
-       .kobj   =       {.name = "raw", },
-       .owner  =       THIS_MODULE,
-};
+static struct cdev raw_cdev;
 
 static int __init raw_init(void)
 {