diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-23 03:00:39 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 07:38:13 -0800 |
commit | 910f5d202ce39cc78de1bbb679285a3167de9fb2 (patch) | |
tree | 2c5b55c2b141aaf016c459beb397fc702c41b967 /sound/oss/btaudio.c | |
parent | 82d4dc5adb0055393248ad4ab8de392fac708a12 (diff) | |
download | linux-910f5d202ce39cc78de1bbb679285a3167de9fb2.tar.bz2 |
[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/btaudio.c')
-rw-r--r-- | sound/oss/btaudio.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/sound/oss/btaudio.c b/sound/oss/btaudio.c index 4007a5680acb..bfe3b534ef30 100644 --- a/sound/oss/btaudio.c +++ b/sound/oss/btaudio.c @@ -32,6 +32,8 @@ #include <linux/soundcard.h> #include <linux/slab.h> #include <linux/kdev_t.h> +#include <linux/mutex.h> + #include <asm/uaccess.h> #include <asm/io.h> @@ -108,7 +110,7 @@ struct btaudio { /* locking */ int users; - struct semaphore lock; + struct mutex lock; /* risc instructions */ unsigned int risc_size; @@ -440,7 +442,7 @@ static struct file_operations btaudio_mixer_fops = { static int btaudio_dsp_open(struct inode *inode, struct file *file, struct btaudio *bta, int analog) { - down(&bta->lock); + mutex_lock(&bta->lock); if (bta->users) goto busy; bta->users++; @@ -452,11 +454,11 @@ static int btaudio_dsp_open(struct inode *inode, struct file *file, bta->read_count = 0; bta->sampleshift = 0; - up(&bta->lock); + mutex_unlock(&bta->lock); return 0; busy: - up(&bta->lock); + mutex_unlock(&bta->lock); return -EBUSY; } @@ -496,11 +498,11 @@ static int btaudio_dsp_release(struct inode *inode, struct file *file) { struct btaudio *bta = file->private_data; - down(&bta->lock); + mutex_lock(&bta->lock); if (bta->recording) stop_recording(bta); bta->users--; - up(&bta->lock); + mutex_unlock(&bta->lock); return 0; } @@ -513,7 +515,7 @@ static ssize_t btaudio_dsp_read(struct file *file, char __user *buffer, DECLARE_WAITQUEUE(wait, current); add_wait_queue(&bta->readq, &wait); - down(&bta->lock); + mutex_lock(&bta->lock); while (swcount > 0) { if (0 == bta->read_count) { if (!bta->recording) { @@ -528,10 +530,10 @@ static ssize_t btaudio_dsp_read(struct file *file, char __user *buffer, ret = -EAGAIN; break; } - up(&bta->lock); + mutex_unlock(&bta->lock); current->state = TASK_INTERRUPTIBLE; schedule(); - down(&bta->lock); + mutex_lock(&bta->lock); if(signal_pending(current)) { if (0 == ret) ret = -EINTR; @@ -604,7 +606,7 @@ static ssize_t btaudio_dsp_read(struct file *file, char __user *buffer, if (bta->read_offset == bta->buf_size) bta->read_offset = 0; } - up(&bta->lock); + mutex_unlock(&bta->lock); remove_wait_queue(&bta->readq, &wait); current->state = TASK_RUNNING; return ret; @@ -651,10 +653,10 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file, bta->decimation = 0; } if (bta->recording) { - down(&bta->lock); + mutex_lock(&bta->lock); stop_recording(bta); start_recording(bta); - up(&bta->lock); + mutex_unlock(&bta->lock); } /* fall through */ case SOUND_PCM_READ_RATE: @@ -716,10 +718,10 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file, else bta->bits = 16; if (bta->recording) { - down(&bta->lock); + mutex_lock(&bta->lock); stop_recording(bta); start_recording(bta); - up(&bta->lock); + mutex_unlock(&bta->lock); } } if (debug) @@ -736,9 +738,9 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file, case SNDCTL_DSP_RESET: if (bta->recording) { - down(&bta->lock); + mutex_lock(&bta->lock); stop_recording(bta); - up(&bta->lock); + mutex_unlock(&bta->lock); } return 0; case SNDCTL_DSP_GETBLKSIZE: @@ -941,7 +943,7 @@ static int __devinit btaudio_probe(struct pci_dev *pci_dev, if (rate) bta->rate = rate; - init_MUTEX(&bta->lock); + mutex_init(&bta->lock); init_waitqueue_head(&bta->readq); if (-1 != latency) { |