aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-08-10 17:50:44 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-12 14:50:55 -0400
commit4390e60163979621f59e3a25a260289986eacb85 (patch)
tree66bdf6c2077f3cf5ef3617f56f5857b9484d6b5f
parent488a5c8a9a3b67ae117784cd0d73bef53a73d57d (diff)
[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: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Reviewed-by: Satyam Sharma <satyam@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Willem Riede <wrlk@riede.org> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/scsi/osst.c16
-rw-r--r--drivers/scsi/osst.h3
2 files changed, 10 insertions, 9 deletions
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 119739502095..331b789937c4 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -3298,7 +3298,7 @@ static ssize_t osst_write(struct file * filp, const char __user * buf, size_t co
3298 char * name = tape_name(STp); 3298 char * name = tape_name(STp);
3299 3299
3300 3300
3301 if (down_interruptible(&STp->lock)) 3301 if (mutex_lock_interruptible(&STp->lock))
3302 return (-ERESTARTSYS); 3302 return (-ERESTARTSYS);
3303 3303
3304 /* 3304 /*
@@ -3600,7 +3600,7 @@ if (SRpnt) printk(KERN_ERR "%s:A: Not supposed to have SRpnt at line %d\n", name
3600out: 3600out:
3601 if (SRpnt != NULL) osst_release_request(SRpnt); 3601 if (SRpnt != NULL) osst_release_request(SRpnt);
3602 3602
3603 up(&STp->lock); 3603 mutex_unlock(&STp->lock);
3604 3604
3605 return retval; 3605 return retval;
3606} 3606}
@@ -3619,7 +3619,7 @@ static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, lo
3619 char * name = tape_name(STp); 3619 char * name = tape_name(STp);
3620 3620
3621 3621
3622 if (down_interruptible(&STp->lock)) 3622 if (mutex_lock_interruptible(&STp->lock))
3623 return (-ERESTARTSYS); 3623 return (-ERESTARTSYS);
3624 3624
3625 /* 3625 /*
@@ -3785,7 +3785,7 @@ static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, lo
3785out: 3785out:
3786 if (SRpnt != NULL) osst_release_request(SRpnt); 3786 if (SRpnt != NULL) osst_release_request(SRpnt);
3787 3787
3788 up(&STp->lock); 3788 mutex_unlock(&STp->lock);
3789 3789
3790 return retval; 3790 return retval;
3791} 3791}
@@ -4852,7 +4852,7 @@ static int osst_ioctl(struct inode * inode,struct file * file,
4852 char * name = tape_name(STp); 4852 char * name = tape_name(STp);
4853 void __user * p = (void __user *)arg; 4853 void __user * p = (void __user *)arg;
4854 4854
4855 if (down_interruptible(&STp->lock)) 4855 if (mutex_lock_interruptible(&STp->lock))
4856 return -ERESTARTSYS; 4856 return -ERESTARTSYS;
4857 4857
4858#if DEBUG 4858#if DEBUG
@@ -5163,14 +5163,14 @@ static int osst_ioctl(struct inode * inode,struct file * file,
5163 } 5163 }
5164 if (SRpnt) osst_release_request(SRpnt); 5164 if (SRpnt) osst_release_request(SRpnt);
5165 5165
5166 up(&STp->lock); 5166 mutex_unlock(&STp->lock);
5167 5167
5168 return scsi_ioctl(STp->device, cmd_in, p); 5168 return scsi_ioctl(STp->device, cmd_in, p);
5169 5169
5170out: 5170out:
5171 if (SRpnt) osst_release_request(SRpnt); 5171 if (SRpnt) osst_release_request(SRpnt);
5172 5172
5173 up(&STp->lock); 5173 mutex_unlock(&STp->lock);
5174 5174
5175 return retval; 5175 return retval;
5176} 5176}
@@ -5865,7 +5865,7 @@ static int osst_probe(struct device *dev)
5865 tpnt->modes[2].defined = 1; 5865 tpnt->modes[2].defined = 1;
5866 tpnt->density_changed = tpnt->compression_changed = tpnt->blksize_changed = 0; 5866 tpnt->density_changed = tpnt->compression_changed = tpnt->blksize_changed = 0;
5867 5867
5868 init_MUTEX(&tpnt->lock); 5868 mutex_init(&tpnt->lock);
5869 osst_nr_dev++; 5869 osst_nr_dev++;
5870 write_unlock(&os_scsi_tapes_lock); 5870 write_unlock(&os_scsi_tapes_lock);
5871 5871
diff --git a/drivers/scsi/osst.h b/drivers/scsi/osst.h
index 2cc7b5a1606a..5aa22740b5df 100644
--- a/drivers/scsi/osst.h
+++ b/drivers/scsi/osst.h
@@ -4,6 +4,7 @@
4 4
5#include <asm/byteorder.h> 5#include <asm/byteorder.h>
6#include <linux/completion.h> 6#include <linux/completion.h>
7#include <linux/mutex.h>
7 8
8/* FIXME - rename and use the following two types or delete them! 9/* FIXME - rename and use the following two types or delete them!
9 * and the types really should go to st.h anyway... 10 * and the types really should go to st.h anyway...
@@ -532,7 +533,7 @@ struct osst_tape {
532 struct scsi_driver *driver; 533 struct scsi_driver *driver;
533 unsigned capacity; 534 unsigned capacity;
534 struct scsi_device *device; 535 struct scsi_device *device;
535 struct semaphore lock; /* for serialization */ 536 struct mutex lock; /* for serialization */
536 struct completion wait; /* for SCSI commands */ 537 struct completion wait; /* for SCSI commands */
537 struct osst_buffer * buffer; 538 struct osst_buffer * buffer;
538 539