Commit 4390e601 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by James Bottomley

[SCSI] osst: Use mutex instead of semaphore

The OnStream SCSI Tape driver uses a semaphore as mutex.  Use the mutex API
instead of the (binary) semaphore.
Signed-off-by: default avatarMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Reviewed-by: default avatarSatyam Sharma <satyam@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Acked-by: default avatarWillem Riede <wrlk@riede.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 488a5c8a
...@@ -3298,7 +3298,7 @@ static ssize_t osst_write(struct file * filp, const char __user * buf, size_t co ...@@ -3298,7 +3298,7 @@ static ssize_t osst_write(struct file * filp, const char __user * buf, size_t co
char * name = tape_name(STp); char * name = tape_name(STp);
if (down_interruptible(&STp->lock)) if (mutex_lock_interruptible(&STp->lock))
return (-ERESTARTSYS); return (-ERESTARTSYS);
/* /*
...@@ -3600,7 +3600,7 @@ if (SRpnt) printk(KERN_ERR "%s:A: Not supposed to have SRpnt at line %d\n", name ...@@ -3600,7 +3600,7 @@ if (SRpnt) printk(KERN_ERR "%s:A: Not supposed to have SRpnt at line %d\n", name
out: out:
if (SRpnt != NULL) osst_release_request(SRpnt); if (SRpnt != NULL) osst_release_request(SRpnt);
up(&STp->lock); mutex_unlock(&STp->lock);
return retval; return retval;
} }
...@@ -3619,7 +3619,7 @@ static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, lo ...@@ -3619,7 +3619,7 @@ static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, lo
char * name = tape_name(STp); char * name = tape_name(STp);
if (down_interruptible(&STp->lock)) if (mutex_lock_interruptible(&STp->lock))
return (-ERESTARTSYS); return (-ERESTARTSYS);
/* /*
...@@ -3785,7 +3785,7 @@ static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, lo ...@@ -3785,7 +3785,7 @@ static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, lo
out: out:
if (SRpnt != NULL) osst_release_request(SRpnt); if (SRpnt != NULL) osst_release_request(SRpnt);
up(&STp->lock); mutex_unlock(&STp->lock);
return retval; return retval;
} }
...@@ -4852,7 +4852,7 @@ static int osst_ioctl(struct inode * inode,struct file * file, ...@@ -4852,7 +4852,7 @@ static int osst_ioctl(struct inode * inode,struct file * file,
char * name = tape_name(STp); char * name = tape_name(STp);
void __user * p = (void __user *)arg; void __user * p = (void __user *)arg;
if (down_interruptible(&STp->lock)) if (mutex_lock_interruptible(&STp->lock))
return -ERESTARTSYS; return -ERESTARTSYS;
#if DEBUG #if DEBUG
...@@ -5163,14 +5163,14 @@ static int osst_ioctl(struct inode * inode,struct file * file, ...@@ -5163,14 +5163,14 @@ static int osst_ioctl(struct inode * inode,struct file * file,
} }
if (SRpnt) osst_release_request(SRpnt); if (SRpnt) osst_release_request(SRpnt);
up(&STp->lock); mutex_unlock(&STp->lock);
return scsi_ioctl(STp->device, cmd_in, p); return scsi_ioctl(STp->device, cmd_in, p);
out: out:
if (SRpnt) osst_release_request(SRpnt); if (SRpnt) osst_release_request(SRpnt);
up(&STp->lock); mutex_unlock(&STp->lock);
return retval; return retval;
} }
...@@ -5865,7 +5865,7 @@ static int osst_probe(struct device *dev) ...@@ -5865,7 +5865,7 @@ static int osst_probe(struct device *dev)
tpnt->modes[2].defined = 1; tpnt->modes[2].defined = 1;
tpnt->density_changed = tpnt->compression_changed = tpnt->blksize_changed = 0; tpnt->density_changed = tpnt->compression_changed = tpnt->blksize_changed = 0;
init_MUTEX(&tpnt->lock); mutex_init(&tpnt->lock);
osst_nr_dev++; osst_nr_dev++;
write_unlock(&os_scsi_tapes_lock); write_unlock(&os_scsi_tapes_lock);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/mutex.h>
/* FIXME - rename and use the following two types or delete them! /* FIXME - rename and use the following two types or delete them!
* and the types really should go to st.h anyway... * and the types really should go to st.h anyway...
...@@ -532,7 +533,7 @@ struct osst_tape { ...@@ -532,7 +533,7 @@ struct osst_tape {
struct scsi_driver *driver; struct scsi_driver *driver;
unsigned capacity; unsigned capacity;
struct scsi_device *device; struct scsi_device *device;
struct semaphore lock; /* for serialization */ struct mutex lock; /* for serialization */
struct completion wait; /* for SCSI commands */ struct completion wait; /* for SCSI commands */
struct osst_buffer * buffer; struct osst_buffer * buffer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment