[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>
This commit is contained in:
parent
c41d4e3e68
commit
3006d7c671
|
@ -14,9 +14,9 @@
|
||||||
#include <linux/moduleparam.h>
|
#include <linux/moduleparam.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/poll.h>
|
#include <linux/poll.h>
|
||||||
|
#include <linux/mutex.h>
|
||||||
|
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/semaphore.h>
|
|
||||||
#include <asm/atomic.h>
|
#include <asm/atomic.h>
|
||||||
#include <asm/ebcdic.h>
|
#include <asm/ebcdic.h>
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ void dasd_eer_disable(struct dasd_device *device)
|
||||||
* to transfer in a readbuffer, which is protected by the readbuffer_mutex.
|
* to transfer in a readbuffer, which is protected by the readbuffer_mutex.
|
||||||
*/
|
*/
|
||||||
static char readbuffer[PAGE_SIZE];
|
static char readbuffer[PAGE_SIZE];
|
||||||
static DECLARE_MUTEX(readbuffer_mutex);
|
static DEFINE_MUTEX(readbuffer_mutex);
|
||||||
|
|
||||||
static int dasd_eer_open(struct inode *inp, struct file *filp)
|
static int dasd_eer_open(struct inode *inp, struct file *filp)
|
||||||
{
|
{
|
||||||
|
@ -579,7 +579,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
|
||||||
struct eerbuffer *eerb;
|
struct eerbuffer *eerb;
|
||||||
|
|
||||||
eerb = (struct eerbuffer *) filp->private_data;
|
eerb = (struct eerbuffer *) filp->private_data;
|
||||||
if (down_interruptible(&readbuffer_mutex))
|
if (mutex_lock_interruptible(&readbuffer_mutex))
|
||||||
return -ERESTARTSYS;
|
return -ERESTARTSYS;
|
||||||
|
|
||||||
spin_lock_irqsave(&bufferlock, flags);
|
spin_lock_irqsave(&bufferlock, flags);
|
||||||
|
@ -588,7 +588,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
|
||||||
/* has been deleted */
|
/* has been deleted */
|
||||||
eerb->residual = 0;
|
eerb->residual = 0;
|
||||||
spin_unlock_irqrestore(&bufferlock, flags);
|
spin_unlock_irqrestore(&bufferlock, flags);
|
||||||
up(&readbuffer_mutex);
|
mutex_unlock(&readbuffer_mutex);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
} else if (eerb->residual > 0) {
|
} else if (eerb->residual > 0) {
|
||||||
/* OK we still have a second half of a record to deliver */
|
/* 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,
|
||||||
if (!tc) {
|
if (!tc) {
|
||||||
/* no data available */
|
/* no data available */
|
||||||
spin_unlock_irqrestore(&bufferlock, flags);
|
spin_unlock_irqrestore(&bufferlock, flags);
|
||||||
up(&readbuffer_mutex);
|
mutex_unlock(&readbuffer_mutex);
|
||||||
if (filp->f_flags & O_NONBLOCK)
|
if (filp->f_flags & O_NONBLOCK)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
rc = wait_event_interruptible(
|
rc = wait_event_interruptible(
|
||||||
|
@ -610,7 +610,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
|
||||||
eerb->head != eerb->tail);
|
eerb->head != eerb->tail);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
if (down_interruptible(&readbuffer_mutex))
|
if (mutex_lock_interruptible(&readbuffer_mutex))
|
||||||
return -ERESTARTSYS;
|
return -ERESTARTSYS;
|
||||||
spin_lock_irqsave(&bufferlock, flags);
|
spin_lock_irqsave(&bufferlock, flags);
|
||||||
}
|
}
|
||||||
|
@ -626,11 +626,11 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
|
||||||
spin_unlock_irqrestore(&bufferlock, flags);
|
spin_unlock_irqrestore(&bufferlock, flags);
|
||||||
|
|
||||||
if (copy_to_user(buf, readbuffer, effective_count)) {
|
if (copy_to_user(buf, readbuffer, effective_count)) {
|
||||||
up(&readbuffer_mutex);
|
mutex_unlock(&readbuffer_mutex);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
up(&readbuffer_mutex);
|
mutex_unlock(&readbuffer_mutex);
|
||||||
return effective_count;
|
return effective_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue