aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-05-31 11:38:02 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2007-05-31 11:38:10 -0400
commit3006d7c67139e5173cf58986c7b6e080a893e2ac (patch)
tree941adc9eb7e0d8d38ff9a0f50f5fe990789a1fa0 /drivers/s390
parentc41d4e3e688e338418311f449a4c68f6cb8eabbb (diff)
[S390] dasd_eer: use mutex instead of semaphore
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/block/dasd_eer.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c
index a1dc8c466ec9..0c081a664ee8 100644
--- a/drivers/s390/block/dasd_eer.c
+++ b/drivers/s390/block/dasd_eer.c
@@ -14,9 +14,9 @@
14#include <linux/moduleparam.h> 14#include <linux/moduleparam.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/poll.h> 16#include <linux/poll.h>
17#include <linux/mutex.h>
17 18
18#include <asm/uaccess.h> 19#include <asm/uaccess.h>
19#include <asm/semaphore.h>
20#include <asm/atomic.h> 20#include <asm/atomic.h>
21#include <asm/ebcdic.h> 21#include <asm/ebcdic.h>
22 22
@@ -514,7 +514,7 @@ void dasd_eer_disable(struct dasd_device *device)
514 * to transfer in a readbuffer, which is protected by the readbuffer_mutex. 514 * to transfer in a readbuffer, which is protected by the readbuffer_mutex.
515 */ 515 */
516static char readbuffer[PAGE_SIZE]; 516static char readbuffer[PAGE_SIZE];
517static DECLARE_MUTEX(readbuffer_mutex); 517static DEFINE_MUTEX(readbuffer_mutex);
518 518
519static int dasd_eer_open(struct inode *inp, struct file *filp) 519static int dasd_eer_open(struct inode *inp, struct file *filp)
520{ 520{
@@ -579,7 +579,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
579 struct eerbuffer *eerb; 579 struct eerbuffer *eerb;
580 580
581 eerb = (struct eerbuffer *) filp->private_data; 581 eerb = (struct eerbuffer *) filp->private_data;
582 if (down_interruptible(&readbuffer_mutex)) 582 if (mutex_lock_interruptible(&readbuffer_mutex))
583 return -ERESTARTSYS; 583 return -ERESTARTSYS;
584 584
585 spin_lock_irqsave(&bufferlock, flags); 585 spin_lock_irqsave(&bufferlock, flags);
@@ -588,7 +588,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
588 /* has been deleted */ 588 /* has been deleted */
589 eerb->residual = 0; 589 eerb->residual = 0;
590 spin_unlock_irqrestore(&bufferlock, flags); 590 spin_unlock_irqrestore(&bufferlock, flags);
591 up(&readbuffer_mutex); 591 mutex_unlock(&readbuffer_mutex);
592 return -EIO; 592 return -EIO;
593 } else if (eerb->residual > 0) { 593 } else if (eerb->residual > 0) {
594 /* OK we still have a second half of a record to deliver */ 594 /* OK we still have a second half of a record to deliver */
@@ -602,7 +602,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
602 if (!tc) { 602 if (!tc) {
603 /* no data available */ 603 /* no data available */
604 spin_unlock_irqrestore(&bufferlock, flags); 604 spin_unlock_irqrestore(&bufferlock, flags);
605 up(&readbuffer_mutex); 605 mutex_unlock(&readbuffer_mutex);
606 if (filp->f_flags & O_NONBLOCK) 606 if (filp->f_flags & O_NONBLOCK)
607 return -EAGAIN; 607 return -EAGAIN;
608 rc = wait_event_interruptible( 608 rc = wait_event_interruptible(
@@ -610,7 +610,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
610 eerb->head != eerb->tail); 610 eerb->head != eerb->tail);
611 if (rc) 611 if (rc)
612 return rc; 612 return rc;
613 if (down_interruptible(&readbuffer_mutex)) 613 if (mutex_lock_interruptible(&readbuffer_mutex))
614 return -ERESTARTSYS; 614 return -ERESTARTSYS;
615 spin_lock_irqsave(&bufferlock, flags); 615 spin_lock_irqsave(&bufferlock, flags);
616 } 616 }
@@ -626,11 +626,11 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
626 spin_unlock_irqrestore(&bufferlock, flags); 626 spin_unlock_irqrestore(&bufferlock, flags);
627 627
628 if (copy_to_user(buf, readbuffer, effective_count)) { 628 if (copy_to_user(buf, readbuffer, effective_count)) {
629 up(&readbuffer_mutex); 629 mutex_unlock(&readbuffer_mutex);
630 return -EFAULT; 630 return -EFAULT;
631 } 631 }
632 632
633 up(&readbuffer_mutex); 633 mutex_unlock(&readbuffer_mutex);
634 return effective_count; 634 return effective_count;
635} 635}
636 636