Linux 3.2.92
[pandora-kernel.git] / drivers / scsi / ch.c
index d653218..a15474e 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/chio.h>                        /* here are all the ioctls */
 #include <linux/mutex.h>
 #include <linux/idr.h>
-#include <linux/smp_lock.h>
 #include <linux/slab.h>
 
 #include <scsi/scsi.h>
@@ -44,6 +43,7 @@ MODULE_LICENSE("GPL");
 MODULE_ALIAS_CHARDEV_MAJOR(SCSI_CHANGER_MAJOR);
 MODULE_ALIAS_SCSI_DEVICE(TYPE_MEDIUM_CHANGER);
 
+static DEFINE_MUTEX(ch_mutex);
 static int init = 1;
 module_param(init, int, 0444);
 MODULE_PARM_DESC(init, \
@@ -581,19 +581,19 @@ ch_open(struct inode *inode, struct file *file)
        scsi_changer *ch;
        int minor = iminor(inode);
 
-       lock_kernel();
+       mutex_lock(&ch_mutex);
        spin_lock(&ch_index_lock);
        ch = idr_find(&ch_index_idr, minor);
 
        if (NULL == ch || scsi_device_get(ch->device)) {
                spin_unlock(&ch_index_lock);
-               unlock_kernel();
+               mutex_unlock(&ch_mutex);
                return -ENXIO;
        }
        spin_unlock(&ch_index_lock);
 
        file->private_data = ch;
-       unlock_kernel();
+       mutex_unlock(&ch_mutex);
        return 0;
 }
 
@@ -981,6 +981,7 @@ static const struct file_operations changer_fops = {
 #ifdef CONFIG_COMPAT
        .compat_ioctl   = ch_ioctl_compat,
 #endif
+       .llseek         = noop_llseek,
 };
 
 static int __init init_ch_module(void)