aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJes Sorensen <jes@trained-monkey.org>2006-01-11 08:39:45 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2006-01-14 11:55:12 -0500
commita12e25bd59e36d12dcd026ffa3c65d48b5cf5442 (patch)
treea09d828f0e552a9e58dfcfae6c877011e92812cf /drivers
parent3759b788498ffc0b2563181567af4c82d983f921 (diff)
[SCSI] sem2mutex 3w-[x9]xxx
Convert a the 3w-9xxx.c and 3w-xxxx.c drivers to use mutexes instead of semaphores. Untested, but compiles and looks obviously correct. Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/3w-9xxx.c7
-rw-r--r--drivers/scsi/3w-9xxx.h2
-rw-r--r--drivers/scsi/3w-xxxx.c7
-rw-r--r--drivers/scsi/3w-xxxx.h2
4 files changed, 10 insertions, 8 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 3ff74f472249..31c497542272 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -73,6 +73,7 @@
73#include <linux/delay.h> 73#include <linux/delay.h>
74#include <linux/pci.h> 74#include <linux/pci.h>
75#include <linux/time.h> 75#include <linux/time.h>
76#include <linux/mutex.h>
76#include <asm/io.h> 77#include <asm/io.h>
77#include <asm/irq.h> 78#include <asm/irq.h>
78#include <asm/uaccess.h> 79#include <asm/uaccess.h>
@@ -615,7 +616,7 @@ static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int
615 void __user *argp = (void __user *)arg; 616 void __user *argp = (void __user *)arg;
616 617
617 /* Only let one of these through at a time */ 618 /* Only let one of these through at a time */
618 if (down_interruptible(&tw_dev->ioctl_sem)) { 619 if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) {
619 retval = TW_IOCTL_ERROR_OS_EINTR; 620 retval = TW_IOCTL_ERROR_OS_EINTR;
620 goto out; 621 goto out;
621 } 622 }
@@ -852,7 +853,7 @@ out3:
852 /* Now free ioctl buf memory */ 853 /* Now free ioctl buf memory */
853 dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_Ioctl_Buf_Apache) - 1, cpu_addr, dma_handle); 854 dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_Ioctl_Buf_Apache) - 1, cpu_addr, dma_handle);
854out2: 855out2:
855 up(&tw_dev->ioctl_sem); 856 mutex_unlock(&tw_dev->ioctl_lock);
856out: 857out:
857 return retval; 858 return retval;
858} /* End twa_chrdev_ioctl() */ 859} /* End twa_chrdev_ioctl() */
@@ -1182,7 +1183,7 @@ static int twa_initialize_device_extension(TW_Device_Extension *tw_dev)
1182 tw_dev->error_sequence_id = 1; 1183 tw_dev->error_sequence_id = 1;
1183 tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; 1184 tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE;
1184 1185
1185 init_MUTEX(&tw_dev->ioctl_sem); 1186 mutex_init(&tw_dev->ioctl_lock);
1186 init_waitqueue_head(&tw_dev->ioctl_wqueue); 1187 init_waitqueue_head(&tw_dev->ioctl_wqueue);
1187 1188
1188 retval = 0; 1189 retval = 0;
diff --git a/drivers/scsi/3w-9xxx.h b/drivers/scsi/3w-9xxx.h
index 46f22cdc8298..1b16d57f0314 100644
--- a/drivers/scsi/3w-9xxx.h
+++ b/drivers/scsi/3w-9xxx.h
@@ -672,7 +672,7 @@ typedef struct TAG_TW_Device_Extension {
672 u32 ioctl_msec; 672 u32 ioctl_msec;
673 int chrdev_request_id; 673 int chrdev_request_id;
674 wait_queue_head_t ioctl_wqueue; 674 wait_queue_head_t ioctl_wqueue;
675 struct semaphore ioctl_sem; 675 struct mutex ioctl_lock;
676 char aen_clobber; 676 char aen_clobber;
677 unsigned short working_srl; 677 unsigned short working_srl;
678 unsigned short working_branch; 678 unsigned short working_branch;
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index 283f6d25892b..25f678d0780b 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -203,6 +203,7 @@
203#include <linux/delay.h> 203#include <linux/delay.h>
204#include <linux/pci.h> 204#include <linux/pci.h>
205#include <linux/time.h> 205#include <linux/time.h>
206#include <linux/mutex.h>
206#include <asm/io.h> 207#include <asm/io.h>
207#include <asm/irq.h> 208#include <asm/irq.h>
208#include <asm/uaccess.h> 209#include <asm/uaccess.h>
@@ -888,7 +889,7 @@ static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int
888 dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n"); 889 dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n");
889 890
890 /* Only let one of these through at a time */ 891 /* Only let one of these through at a time */
891 if (down_interruptible(&tw_dev->ioctl_sem)) 892 if (mutex_lock_interruptible(&tw_dev->ioctl_lock))
892 return -EINTR; 893 return -EINTR;
893 894
894 /* First copy down the buffer length */ 895 /* First copy down the buffer length */
@@ -1029,7 +1030,7 @@ out2:
1029 /* Now free ioctl buf memory */ 1030 /* Now free ioctl buf memory */
1030 dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_New_Ioctl) - 1, cpu_addr, dma_handle); 1031 dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_New_Ioctl) - 1, cpu_addr, dma_handle);
1031out: 1032out:
1032 up(&tw_dev->ioctl_sem); 1033 mutex_unlock(&tw_dev->ioctl_lock);
1033 return retval; 1034 return retval;
1034} /* End tw_chrdev_ioctl() */ 1035} /* End tw_chrdev_ioctl() */
1035 1036
@@ -1270,7 +1271,7 @@ static int tw_initialize_device_extension(TW_Device_Extension *tw_dev)
1270 tw_dev->pending_tail = TW_Q_START; 1271 tw_dev->pending_tail = TW_Q_START;
1271 tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; 1272 tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE;
1272 1273
1273 init_MUTEX(&tw_dev->ioctl_sem); 1274 mutex_init(&tw_dev->ioctl_lock);
1274 init_waitqueue_head(&tw_dev->ioctl_wqueue); 1275 init_waitqueue_head(&tw_dev->ioctl_wqueue);
1275 1276
1276 return 0; 1277 return 0;
diff --git a/drivers/scsi/3w-xxxx.h b/drivers/scsi/3w-xxxx.h
index 4f81fc39ec57..31fe5ea15920 100644
--- a/drivers/scsi/3w-xxxx.h
+++ b/drivers/scsi/3w-xxxx.h
@@ -420,7 +420,7 @@ typedef struct TAG_TW_Device_Extension {
420 u32 max_sector_count; 420 u32 max_sector_count;
421 u32 aen_count; 421 u32 aen_count;
422 struct Scsi_Host *host; 422 struct Scsi_Host *host;
423 struct semaphore ioctl_sem; 423 struct mutex ioctl_lock;
424 unsigned short aen_queue[TW_Q_LENGTH]; 424 unsigned short aen_queue[TW_Q_LENGTH];
425 unsigned char aen_head; 425 unsigned char aen_head;
426 unsigned char aen_tail; 426 unsigned char aen_tail;