Commit 89c9df1b authored by William Hubbs's avatar William Hubbs Committed by Greg Kroah-Hartman

staging: speakup: soft: remove custom locking macros

Signed-off-by: default avatarWilliam Hubbs <w.d.hubbs@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e6f18383
...@@ -179,23 +179,23 @@ static int softsynth_open(struct inode *inode, struct file *fp) ...@@ -179,23 +179,23 @@ static int softsynth_open(struct inode *inode, struct file *fp)
unsigned long flags; unsigned long flags;
/*if ((fp->f_flags & O_ACCMODE) != O_RDONLY) */ /*if ((fp->f_flags & O_ACCMODE) != O_RDONLY) */
/* return -EPERM; */ /* return -EPERM; */
spk_lock(flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
if (synth_soft.alive) { if (synth_soft.alive) {
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return -EBUSY; return -EBUSY;
} }
synth_soft.alive = 1; synth_soft.alive = 1;
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return 0; return 0;
} }
static int softsynth_close(struct inode *inode, struct file *fp) static int softsynth_close(struct inode *inode, struct file *fp)
{ {
unsigned long flags; unsigned long flags;
spk_lock(flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
synth_soft.alive = 0; synth_soft.alive = 0;
init_pos = 0; init_pos = 0;
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
/* Make sure we let applications go before leaving */ /* Make sure we let applications go before leaving */
speakup_start_ttys(); speakup_start_ttys();
return 0; return 0;
...@@ -212,12 +212,12 @@ static ssize_t softsynth_read(struct file *fp, char *buf, size_t count, ...@@ -212,12 +212,12 @@ static ssize_t softsynth_read(struct file *fp, char *buf, size_t count,
unsigned long flags; unsigned long flags;
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
spk_lock(flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
while (1) { while (1) {
prepare_to_wait(&speakup_event, &wait, TASK_INTERRUPTIBLE); prepare_to_wait(&speakup_event, &wait, TASK_INTERRUPTIBLE);
if (!synth_buffer_empty() || speakup_info.flushing) if (!synth_buffer_empty() || speakup_info.flushing)
break; break;
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
if (fp->f_flags & O_NONBLOCK) { if (fp->f_flags & O_NONBLOCK) {
finish_wait(&speakup_event, &wait); finish_wait(&speakup_event, &wait);
return -EAGAIN; return -EAGAIN;
...@@ -227,7 +227,7 @@ static ssize_t softsynth_read(struct file *fp, char *buf, size_t count, ...@@ -227,7 +227,7 @@ static ssize_t softsynth_read(struct file *fp, char *buf, size_t count,
return -ERESTARTSYS; return -ERESTARTSYS;
} }
schedule(); schedule();
spk_lock(flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
} }
finish_wait(&speakup_event, &wait); finish_wait(&speakup_event, &wait);
...@@ -244,16 +244,16 @@ static ssize_t softsynth_read(struct file *fp, char *buf, size_t count, ...@@ -244,16 +244,16 @@ static ssize_t softsynth_read(struct file *fp, char *buf, size_t count,
} else { } else {
ch = synth_buffer_getc(); ch = synth_buffer_getc();
} }
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
if (copy_to_user(cp, &ch, 1)) if (copy_to_user(cp, &ch, 1))
return -EFAULT; return -EFAULT;
spk_lock(flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
chars_sent++; chars_sent++;
cp++; cp++;
} }
*pos += chars_sent; *pos += chars_sent;
empty = synth_buffer_empty(); empty = synth_buffer_empty();
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
if (empty) { if (empty) {
speakup_start_ttys(); speakup_start_ttys();
*pos = 0; *pos = 0;
...@@ -285,10 +285,10 @@ static unsigned int softsynth_poll(struct file *fp, ...@@ -285,10 +285,10 @@ static unsigned int softsynth_poll(struct file *fp,
int ret = 0; int ret = 0;
poll_wait(fp, &speakup_event, wait); poll_wait(fp, &speakup_event, wait);
spk_lock(flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
if (!synth_buffer_empty() || speakup_info.flushing) if (!synth_buffer_empty() || speakup_info.flushing)
ret = POLLIN | POLLRDNORM; ret = POLLIN | POLLRDNORM;
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return ret; return ret;
} }
......
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