osst: mutex conversion
PATCH 1/1 osst: mutex conversion
switch osst from semaphores to mutexes
Signed-off-by Christoph Hellwig <[email protected]>
drivers/scsi/osst.c +8 -8
@@ -3243,7 +3243,7 @@char * name =tape_name (STp); -if (down_interruptible (&STp->lock)) +if (mutex_lock_interruptible (&STp->lock))return (-ERESTARTSYS );/*
@@ -3545,7 +3545,7 @@ out:if (SRpnt !=NULL )scsi_release_request (SRpnt); -up (&STp->lock); +mutex_unlock (&STp->lock);return retval; }
@@ -3564,7 +3564,7 @@char * name =tape_name (STp); -if (down_interruptible (&STp->lock)) +if (mutex_lock_interruptible (&STp->lock))return (-ERESTARTSYS );/*
@@ -3730,7 +3730,7 @@ out:if (SRpnt !=NULL )scsi_release_request (SRpnt); -up (&STp->lock); +mutex_unlock (&STp->lock);return retval; }
@@ -4798,7 +4798,7 @@char * name =tape_name (STp);void __user * p = (void __user *)arg; -if (down_interruptible (&STp->lock)) +if (mutex_lock_interruptible (&STp->lock))return -ERESTARTSYS ;#if DEBUG
@@ -5109,14 +5109,14 @@ }if (SRpnt)scsi_release_request (SRpnt); -up (&STp->lock); +mutex_unlock (&STp->lock);return scsi_ioctl (STp->device, cmd_in, p); out:if (SRpnt)scsi_release_request (SRpnt); -up (&STp->lock); +mutex_unlock (&STp->lock);return retval; }
@@ -5792,7 +5792,7 @@ tpnt->modes[2 ].defined =1 ; tpnt->density_changed = tpnt->compression_changed = tpnt->blksize_changed =0 ; -init_MUTEX (&tpnt->lock); +mutex_init (&tpnt->lock); osst_nr_dev++;write_unlock (&os_scsi_tapes_lock); {
drivers/scsi/osst.h +2 -1
@@ -5,6 +5,7 @@#include <asm/byteorder.h> #include <linux/config.h> #include <linux/completion.h> +#include <linux/mutex.h> /* FIXME - rename and use the following two types or delete them! * and the types really should go to st.h anyway...
@@ -532,7 +533,7 @@struct scsi_driver *driver;unsigned capacity;struct scsi_device *device; -struct semaphore lock;/* for serialization */ +struct mutex lock;/* for serialization */ struct completion wait;/* for SCSI commands */ struct osst_buffer * buffer;