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