aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/3w-xxxx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/3w-xxxx.c')
-rw-r--r--drivers/scsi/3w-xxxx.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index 5faf903ca8c8..608f3b28b25e 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -880,7 +880,7 @@ static int tw_allocate_memory(TW_Device_Extension *tw_dev, int size, int which)
880} /* End tw_allocate_memory() */ 880} /* End tw_allocate_memory() */
881 881
882/* This function handles ioctl for the character device */ 882/* This function handles ioctl for the character device */
883static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 883static long tw_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
884{ 884{
885 int request_id; 885 int request_id;
886 dma_addr_t dma_handle; 886 dma_addr_t dma_handle;
@@ -888,6 +888,7 @@ static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int
888 unsigned long flags; 888 unsigned long flags;
889 unsigned int data_buffer_length = 0; 889 unsigned int data_buffer_length = 0;
890 unsigned long data_buffer_length_adjusted = 0; 890 unsigned long data_buffer_length_adjusted = 0;
891 struct inode *inode = file->f_dentry->d_inode;
891 unsigned long *cpu_addr; 892 unsigned long *cpu_addr;
892 long timeout; 893 long timeout;
893 TW_New_Ioctl *tw_ioctl; 894 TW_New_Ioctl *tw_ioctl;
@@ -898,9 +899,12 @@ static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int
898 899
899 dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n"); 900 dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n");
900 901
902 lock_kernel();
901 /* Only let one of these through at a time */ 903 /* Only let one of these through at a time */
902 if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) 904 if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) {
905 unlock_kernel();
903 return -EINTR; 906 return -EINTR;
907 }
904 908
905 /* First copy down the buffer length */ 909 /* First copy down the buffer length */
906 if (copy_from_user(&data_buffer_length, argp, sizeof(unsigned int))) 910 if (copy_from_user(&data_buffer_length, argp, sizeof(unsigned int)))
@@ -1029,6 +1033,7 @@ out2:
1029 dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_New_Ioctl) - 1, cpu_addr, dma_handle); 1033 dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_New_Ioctl) - 1, cpu_addr, dma_handle);
1030out: 1034out:
1031 mutex_unlock(&tw_dev->ioctl_lock); 1035 mutex_unlock(&tw_dev->ioctl_lock);
1036 unlock_kernel();
1032 return retval; 1037 return retval;
1033} /* End tw_chrdev_ioctl() */ 1038} /* End tw_chrdev_ioctl() */
1034 1039
@@ -1051,7 +1056,7 @@ static int tw_chrdev_open(struct inode *inode, struct file *file)
1051/* File operations struct for character device */ 1056/* File operations struct for character device */
1052static const struct file_operations tw_fops = { 1057static const struct file_operations tw_fops = {
1053 .owner = THIS_MODULE, 1058 .owner = THIS_MODULE,
1054 .ioctl = tw_chrdev_ioctl, 1059 .unlocked_ioctl = tw_chrdev_ioctl,
1055 .open = tw_chrdev_open, 1060 .open = tw_chrdev_open,
1056 .release = NULL 1061 .release = NULL
1057}; 1062};