aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/sonicvibes.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-23 03:00:39 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 07:38:13 -0800
commit910f5d202ce39cc78de1bbb679285a3167de9fb2 (patch)
tree2c5b55c2b141aaf016c459beb397fc702c41b967 /sound/oss/sonicvibes.c
parent[PATCH] sem2mutex: drivers/block/nbd.c (diff)
downloadlinux-dev-910f5d202ce39cc78de1bbb679285a3167de9fb2.tar.xz
linux-dev-910f5d202ce39cc78de1bbb679285a3167de9fb2.zip
[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/sonicvibes.c')
-rw-r--r--sound/oss/sonicvibes.c48
1 files changed, 25 insertions, 23 deletions
diff --git a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c
index 71b05e2f6977..69a4b8778b51 100644
--- a/sound/oss/sonicvibes.c
+++ b/sound/oss/sonicvibes.c
@@ -116,6 +116,8 @@
#include <linux/spinlock.h>
#include <linux/smp_lock.h>
#include <linux/gameport.h>
+#include <linux/mutex.h>
+
#include <asm/io.h>
#include <asm/uaccess.h>
@@ -328,7 +330,7 @@ struct sv_state {
unsigned char fmt, enable;
spinlock_t lock;
- struct semaphore open_sem;
+ struct mutex open_mutex;
mode_t open_mode;
wait_queue_head_t open_wait;
@@ -1922,21 +1924,21 @@ static int sv_open(struct inode *inode, struct file *file)
VALIDATE_STATE(s);
file->private_data = s;
/* wait for device to become free */
- down(&s->open_sem);
+ mutex_lock(&s->open_mutex);
while (s->open_mode & file->f_mode) {
if (file->f_flags & O_NONBLOCK) {
- up(&s->open_sem);
+ mutex_unlock(&s->open_mutex);
return -EBUSY;
}
add_wait_queue(&s->open_wait, &wait);
__set_current_state(TASK_INTERRUPTIBLE);
- up(&s->open_sem);
+ mutex_unlock(&s->open_mutex);
schedule();
remove_wait_queue(&s->open_wait, &wait);
set_current_state(TASK_RUNNING);
if (signal_pending(current))
return -ERESTARTSYS;
- down(&s->open_sem);
+ mutex_lock(&s->open_mutex);
}
if (file->f_mode & FMODE_READ) {
fmtm &= ~((SV_CFMT_STEREO | SV_CFMT_16BIT) << SV_CFMT_CSHIFT);
@@ -1956,7 +1958,7 @@ static int sv_open(struct inode *inode, struct file *file)
}
set_fmt(s, fmtm, fmts);
s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
- up(&s->open_sem);
+ mutex_unlock(&s->open_mutex);
return nonseekable_open(inode, file);
}
@@ -1968,7 +1970,7 @@ static int sv_release(struct inode *inode, struct file *file)
lock_kernel();
if (file->f_mode & FMODE_WRITE)
drain_dac(s, file->f_flags & O_NONBLOCK);
- down(&s->open_sem);
+ mutex_lock(&s->open_mutex);
if (file->f_mode & FMODE_WRITE) {
stop_dac(s);
dealloc_dmabuf(s, &s->dma_dac);
@@ -1979,7 +1981,7 @@ static int sv_release(struct inode *inode, struct file *file)
}
s->open_mode &= ~(file->f_mode & (FMODE_READ|FMODE_WRITE));
wake_up(&s->open_wait);
- up(&s->open_sem);
+ mutex_unlock(&s->open_mutex);
unlock_kernel();
return 0;
}
@@ -2167,21 +2169,21 @@ static int sv_midi_open(struct inode *inode, struct file *file)
VALIDATE_STATE(s);
file->private_data = s;
/* wait for device to become free */
- down(&s->open_sem);
+ mutex_lock(&s->open_mutex);
while (s->open_mode & (file->f_mode << FMODE_MIDI_SHIFT)) {
if (file->f_flags & O_NONBLOCK) {
- up(&s->open_sem);
+ mutex_unlock(&s->open_mutex);
return -EBUSY;
}
add_wait_queue(&s->open_wait, &wait);
__set_current_state(TASK_INTERRUPTIBLE);
- up(&s->open_sem);
+ mutex_unlock(&s->open_mutex);
schedule();
remove_wait_queue(&s->open_wait, &wait);
set_current_state(TASK_RUNNING);
if (signal_pending(current))
return -ERESTARTSYS;
- down(&s->open_sem);
+ mutex_lock(&s->open_mutex);
}
spin_lock_irqsave(&s->lock, flags);
if (!(s->open_mode & (FMODE_MIDI_READ | FMODE_MIDI_WRITE))) {
@@ -2210,7 +2212,7 @@ static int sv_midi_open(struct inode *inode, struct file *file)
}
spin_unlock_irqrestore(&s->lock, flags);
s->open_mode |= (file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE);
- up(&s->open_sem);
+ mutex_unlock(&s->open_mutex);
return nonseekable_open(inode, file);
}
@@ -2248,7 +2250,7 @@ static int sv_midi_release(struct inode *inode, struct file *file)
remove_wait_queue(&s->midi.owait, &wait);
set_current_state(TASK_RUNNING);
}
- down(&s->open_sem);
+ mutex_lock(&s->open_mutex);
s->open_mode &= ~((file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ|FMODE_MIDI_WRITE));
spin_lock_irqsave(&s->lock, flags);
if (!(s->open_mode & (FMODE_MIDI_READ | FMODE_MIDI_WRITE))) {
@@ -2257,7 +2259,7 @@ static int sv_midi_release(struct inode *inode, struct file *file)
}
spin_unlock_irqrestore(&s->lock, flags);
wake_up(&s->open_wait);
- up(&s->open_sem);
+ mutex_unlock(&s->open_mutex);
unlock_kernel();
return 0;
}
@@ -2388,21 +2390,21 @@ static int sv_dmfm_open(struct inode *inode, struct file *file)
VALIDATE_STATE(s);
file->private_data = s;
/* wait for device to become free */
- down(&s->open_sem);
+ mutex_lock(&s->open_mutex);
while (s->open_mode & FMODE_DMFM) {
if (file->f_flags & O_NONBLOCK) {
- up(&s->open_sem);
+ mutex_unlock(&s->open_mutex);
return -EBUSY;
}
add_wait_queue(&s->open_wait, &wait);
__set_current_state(TASK_INTERRUPTIBLE);
- up(&s->open_sem);
+ mutex_unlock(&s->open_mutex);
schedule();
remove_wait_queue(&s->open_wait, &wait);
set_current_state(TASK_RUNNING);
if (signal_pending(current))
return -ERESTARTSYS;
- down(&s->open_sem);
+ mutex_lock(&s->open_mutex);
}
/* init the stuff */
outb(1, s->iosynth);
@@ -2412,7 +2414,7 @@ static int sv_dmfm_open(struct inode *inode, struct file *file)
outb(5, s->iosynth+2);
outb(1, s->iosynth+3); /* enable OPL3 */
s->open_mode |= FMODE_DMFM;
- up(&s->open_sem);
+ mutex_unlock(&s->open_mutex);
return nonseekable_open(inode, file);
}
@@ -2423,7 +2425,7 @@ static int sv_dmfm_release(struct inode *inode, struct file *file)
VALIDATE_STATE(s);
lock_kernel();
- down(&s->open_sem);
+ mutex_lock(&s->open_mutex);
s->open_mode &= ~FMODE_DMFM;
for (regb = 0xb0; regb < 0xb9; regb++) {
outb(regb, s->iosynth);
@@ -2432,7 +2434,7 @@ static int sv_dmfm_release(struct inode *inode, struct file *file)
outb(0, s->iosynth+3);
}
wake_up(&s->open_wait);
- up(&s->open_sem);
+ mutex_unlock(&s->open_mutex);
unlock_kernel();
return 0;
}
@@ -2582,7 +2584,7 @@ static int __devinit sv_probe(struct pci_dev *pcidev, const struct pci_device_id
init_waitqueue_head(&s->open_wait);
init_waitqueue_head(&s->midi.iwait);
init_waitqueue_head(&s->midi.owait);
- init_MUTEX(&s->open_sem);
+ mutex_init(&s->open_mutex);
spin_lock_init(&s->lock);
s->magic = SV_MAGIC;
s->dev = pcidev;