Merge branch 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic...
[pandora-kernel.git] / drivers / scsi / 3w-sas.c
index d38000d..f481e73 100644 (file)
@@ -750,19 +750,22 @@ static void twl_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_comm
 
 /* This function handles ioctl for the character device
    This interface is used by smartmontools open source software */
-static int twl_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+static long twl_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        long timeout;
        unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0;
        dma_addr_t dma_handle;
        int request_id = 0;
        TW_Ioctl_Driver_Command driver_command;
+       struct inode *inode = file->f_dentry->d_inode;
        TW_Ioctl_Buf_Apache *tw_ioctl;
        TW_Command_Full *full_command_packet;
        TW_Device_Extension *tw_dev = twl_device_extension_list[iminor(inode)];
        int retval = -EFAULT;
        void __user *argp = (void __user *)arg;
 
+       lock_kernel();
+
        /* Only let one of these through at a time */
        if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) {
                retval = -EINTR;
@@ -858,6 +861,7 @@ out3:
 out2:
        mutex_unlock(&tw_dev->ioctl_lock);
 out:
+       unlock_kernel();
        return retval;
 } /* End twl_chrdev_ioctl() */
 
@@ -884,7 +888,7 @@ out:
 /* File operations struct for character device */
 static const struct file_operations twl_fops = {
        .owner          = THIS_MODULE,
-       .ioctl          = twl_chrdev_ioctl,
+       .unlocked_ioctl = twl_chrdev_ioctl,
        .open           = twl_chrdev_open,
        .release        = NULL
 };