aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/nec_vrc5477.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-23 06:00:39 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 10:38:13 -0500
commit910f5d202ce39cc78de1bbb679285a3167de9fb2 (patch)
tree2c5b55c2b141aaf016c459beb397fc702c41b967 /sound/oss/nec_vrc5477.c
parent82d4dc5adb0055393248ad4ab8de392fac708a12 (diff)
[PATCH] sem2mutex: sound/oss/
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'sound/oss/nec_vrc5477.c')
-rw-r--r--sound/oss/nec_vrc5477.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/sound/oss/nec_vrc5477.c b/sound/oss/nec_vrc5477.c
index fbb9170e8e0a..21c1954d9108 100644
--- a/sound/oss/nec_vrc5477.c
+++ b/sound/oss/nec_vrc5477.c
@@ -78,6 +78,8 @@
78#include <linux/spinlock.h> 78#include <linux/spinlock.h>
79#include <linux/smp_lock.h> 79#include <linux/smp_lock.h>
80#include <linux/ac97_codec.h> 80#include <linux/ac97_codec.h>
81#include <linux/mutex.h>
82
81#include <asm/io.h> 83#include <asm/io.h>
82#include <asm/dma.h> 84#include <asm/dma.h>
83#include <asm/uaccess.h> 85#include <asm/uaccess.h>
@@ -198,7 +200,7 @@ struct vrc5477_ac97_state {
198 unsigned short extended_status; 200 unsigned short extended_status;
199 201
200 spinlock_t lock; 202 spinlock_t lock;
201 struct semaphore open_sem; 203 struct mutex open_mutex;
202 mode_t open_mode; 204 mode_t open_mode;
203 wait_queue_head_t open_wait; 205 wait_queue_head_t open_wait;
204 206
@@ -1617,22 +1619,22 @@ static int vrc5477_ac97_open(struct inode *inode, struct file *file)
1617 file->private_data = s; 1619 file->private_data = s;
1618 1620
1619 /* wait for device to become free */ 1621 /* wait for device to become free */
1620 down(&s->open_sem); 1622 mutex_lock(&s->open_mutex);
1621 while (s->open_mode & file->f_mode) { 1623 while (s->open_mode & file->f_mode) {
1622 1624
1623 if (file->f_flags & O_NONBLOCK) { 1625 if (file->f_flags & O_NONBLOCK) {
1624 up(&s->open_sem); 1626 mutex_unlock(&s->open_mutex);
1625 return -EBUSY; 1627 return -EBUSY;
1626 } 1628 }
1627 add_wait_queue(&s->open_wait, &wait); 1629 add_wait_queue(&s->open_wait, &wait);
1628 __set_current_state(TASK_INTERRUPTIBLE); 1630 __set_current_state(TASK_INTERRUPTIBLE);
1629 up(&s->open_sem); 1631 mutex_unlock(&s->open_mutex);
1630 schedule(); 1632 schedule();
1631 remove_wait_queue(&s->open_wait, &wait); 1633 remove_wait_queue(&s->open_wait, &wait);
1632 set_current_state(TASK_RUNNING); 1634 set_current_state(TASK_RUNNING);
1633 if (signal_pending(current)) 1635 if (signal_pending(current))
1634 return -ERESTARTSYS; 1636 return -ERESTARTSYS;
1635 down(&s->open_sem); 1637 mutex_lock(&s->open_mutex);
1636 } 1638 }
1637 1639
1638 spin_lock_irqsave(&s->lock, flags); 1640 spin_lock_irqsave(&s->lock, flags);
@@ -1659,7 +1661,7 @@ static int vrc5477_ac97_open(struct inode *inode, struct file *file)
1659 bailout: 1661 bailout:
1660 spin_unlock_irqrestore(&s->lock, flags); 1662 spin_unlock_irqrestore(&s->lock, flags);
1661 1663
1662 up(&s->open_sem); 1664 mutex_unlock(&s->open_mutex);
1663 return ret; 1665 return ret;
1664} 1666}
1665 1667
@@ -1671,7 +1673,7 @@ static int vrc5477_ac97_release(struct inode *inode, struct file *file)
1671 lock_kernel(); 1673 lock_kernel();
1672 if (file->f_mode & FMODE_WRITE) 1674 if (file->f_mode & FMODE_WRITE)
1673 drain_dac(s, file->f_flags & O_NONBLOCK); 1675 drain_dac(s, file->f_flags & O_NONBLOCK);
1674 down(&s->open_sem); 1676 mutex_lock(&s->open_mutex);
1675 if (file->f_mode & FMODE_WRITE) { 1677 if (file->f_mode & FMODE_WRITE) {
1676 stop_dac(s); 1678 stop_dac(s);
1677 dealloc_dmabuf(s, &s->dma_dac); 1679 dealloc_dmabuf(s, &s->dma_dac);
@@ -1681,7 +1683,7 @@ static int vrc5477_ac97_release(struct inode *inode, struct file *file)
1681 dealloc_dmabuf(s, &s->dma_adc); 1683 dealloc_dmabuf(s, &s->dma_adc);
1682 } 1684 }
1683 s->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE); 1685 s->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE);
1684 up(&s->open_sem); 1686 mutex_unlock(&s->open_mutex);
1685 wake_up(&s->open_wait); 1687 wake_up(&s->open_wait);
1686 unlock_kernel(); 1688 unlock_kernel();
1687 return 0; 1689 return 0;
@@ -1867,7 +1869,7 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
1867 init_waitqueue_head(&s->dma_adc.wait); 1869 init_waitqueue_head(&s->dma_adc.wait);
1868 init_waitqueue_head(&s->dma_dac.wait); 1870 init_waitqueue_head(&s->dma_dac.wait);
1869 init_waitqueue_head(&s->open_wait); 1871 init_waitqueue_head(&s->open_wait);
1870 init_MUTEX(&s->open_sem); 1872 mutex_init(&s->open_mutex);
1871 spin_lock_init(&s->lock); 1873 spin_lock_init(&s->lock);
1872 1874
1873 s->dev = pcidev; 1875 s->dev = pcidev;