summaryrefslogtreecommitdiffstats
path: root/sound/oss/vwsnd.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/vwsnd.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/vwsnd.c')
-rw-r--r--sound/oss/vwsnd.c61
1 files changed, 31 insertions, 30 deletions
diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c
index 265423054ca..b372e88e857 100644
--- a/sound/oss/vwsnd.c
+++ b/sound/oss/vwsnd.c
@@ -94,7 +94,7 @@
* Open will block until the previous client has closed the
* device, unless O_NONBLOCK is specified.
*
- * The semaphore devc->io_sema serializes PCM I/O syscalls. This
+ * The semaphore devc->io_mutex serializes PCM I/O syscalls. This
* is unnecessary in Linux 2.2, because the kernel lock
* serializes read, write, and ioctl globally, but it's there,
* ready for the brave, new post-kernel-lock world.
@@ -105,7 +105,7 @@
* area it owns and update its pointers. See pcm_output() and
* pcm_input() for most of the gory stuff.
*
- * devc->mix_sema serializes all mixer ioctls. This is also
+ * devc->mix_mutex serializes all mixer ioctls. This is also
* redundant because of the kernel lock.
*
* The lowest level lock is lith->lithium_lock. It is a
@@ -148,7 +148,8 @@
#include <linux/smp_lock.h>
#include <linux/wait.h>
#include <linux/interrupt.h>
-#include <asm/semaphore.h>
+#include <linux/mutex.h>
+
#include <asm/mach-visws/cobalt.h>
#include "sound_config.h"
@@ -1447,11 +1448,11 @@ typedef enum vwsnd_port_flags {
*
* port->lock protects: hwstate, flags, swb_[iu]_avail.
*
- * devc->io_sema protects: swstate, sw_*, swb_[iu]_idx.
+ * devc->io_mutex protects: swstate, sw_*, swb_[iu]_idx.
*
* everything else is only written by open/release or
* pcm_{setup,shutdown}(), which are serialized by a
- * combination of devc->open_sema and devc->io_sema.
+ * combination of devc->open_mutex and devc->io_mutex.
*/
typedef struct vwsnd_port {
@@ -1507,9 +1508,9 @@ typedef struct vwsnd_dev {
int audio_minor; /* minor number of audio device */
int mixer_minor; /* minor number of mixer device */
- struct semaphore open_sema;
- struct semaphore io_sema;
- struct semaphore mix_sema;
+ struct mutex open_mutex;
+ struct mutex io_mutex;
+ struct mutex mix_mutex;
mode_t open_mode;
wait_queue_head_t open_wait;
@@ -1633,7 +1634,7 @@ static __inline__ unsigned int swb_inc_i(vwsnd_port_t *port, int inc)
* mode-setting ioctls have been done, but before the first I/O is
* done.
*
- * Locking: called with devc->io_sema held.
+ * Locking: called with devc->io_mutex held.
*
* Returns 0 on success, -errno on failure.
*/
@@ -2319,9 +2320,9 @@ static ssize_t vwsnd_audio_read(struct file *file,
vwsnd_dev_t *devc = file->private_data;
ssize_t ret;
- down(&devc->io_sema);
+ mutex_lock(&devc->io_mutex);
ret = vwsnd_audio_do_read(file, buffer, count, ppos);
- up(&devc->io_sema);
+ mutex_unlock(&devc->io_mutex);
return ret;
}
@@ -2394,9 +2395,9 @@ static ssize_t vwsnd_audio_write(struct file *file,
vwsnd_dev_t *devc = file->private_data;
ssize_t ret;
- down(&devc->io_sema);
+ mutex_lock(&devc->io_mutex);
ret = vwsnd_audio_do_write(file, buffer, count, ppos);
- up(&devc->io_sema);
+ mutex_unlock(&devc->io_mutex);
return ret;
}
@@ -2891,9 +2892,9 @@ static int vwsnd_audio_ioctl(struct inode *inode,
vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data;
int ret;
- down(&devc->io_sema);
+ mutex_lock(&devc->io_mutex);
ret = vwsnd_audio_do_ioctl(inode, file, cmd, arg);
- up(&devc->io_sema);
+ mutex_unlock(&devc->io_mutex);
return ret;
}
@@ -2929,9 +2930,9 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file)
return -ENODEV;
}
- down(&devc->open_sema);
+ mutex_lock(&devc->open_mutex);
while (devc->open_mode & file->f_mode) {
- up(&devc->open_sema);
+ mutex_unlock(&devc->open_mutex);
if (file->f_flags & O_NONBLOCK) {
DEC_USE_COUNT;
return -EBUSY;
@@ -2941,10 +2942,10 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file)
DEC_USE_COUNT;
return -ERESTARTSYS;
}
- down(&devc->open_sema);
+ mutex_lock(&devc->open_mutex);
}
devc->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
- up(&devc->open_sema);
+ mutex_unlock(&devc->open_mutex);
/* get default sample format from minor number. */
@@ -2960,7 +2961,7 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file)
/* Initialize vwsnd_ports. */
- down(&devc->io_sema);
+ mutex_lock(&devc->io_mutex);
{
if (file->f_mode & FMODE_READ) {
devc->rport.swstate = SW_INITIAL;
@@ -2987,7 +2988,7 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file)
devc->wport.frag_count = 0;
}
}
- up(&devc->io_sema);
+ mutex_unlock(&devc->io_mutex);
file->private_data = devc;
DBGRV();
@@ -3005,7 +3006,7 @@ static int vwsnd_audio_release(struct inode *inode, struct file *file)
int err = 0;
lock_kernel();
- down(&devc->io_sema);
+ mutex_lock(&devc->io_mutex);
{
DBGEV("(inode=0x%p, file=0x%p)\n", inode, file);
@@ -3022,13 +3023,13 @@ static int vwsnd_audio_release(struct inode *inode, struct file *file)
if (wport)
wport->swstate = SW_OFF;
}
- up(&devc->io_sema);
+ mutex_unlock(&devc->io_mutex);
- down(&devc->open_sema);
+ mutex_lock(&devc->open_mutex);
{
devc->open_mode &= ~file->f_mode;
}
- up(&devc->open_sema);
+ mutex_unlock(&devc->open_mutex);
wake_up(&devc->open_wait);
DEC_USE_COUNT;
DBGR();
@@ -3213,7 +3214,7 @@ static int vwsnd_mixer_ioctl(struct inode *ioctl,
DBGEV("(devc=0x%p, cmd=0x%x, arg=0x%lx)\n", devc, cmd, arg);
- down(&devc->mix_sema);
+ mutex_lock(&devc->mix_mutex);
{
if ((cmd & ~nrmask) == MIXER_READ(0))
retval = mixer_read_ioctl(devc, nr, (void __user *) arg);
@@ -3222,7 +3223,7 @@ static int vwsnd_mixer_ioctl(struct inode *ioctl,
else
retval = -EINVAL;
}
- up(&devc->mix_sema);
+ mutex_unlock(&devc->mix_mutex);
return retval;
}
@@ -3376,9 +3377,9 @@ static int __init attach_vwsnd(struct address_info *hw_config)
/* Initialize as much of *devc as possible */
- init_MUTEX(&devc->open_sema);
- init_MUTEX(&devc->io_sema);
- init_MUTEX(&devc->mix_sema);
+ mutex_init(&devc->open_mutex);
+ mutex_init(&devc->io_mutex);
+ mutex_init(&devc->mix_mutex);
devc->open_mode = 0;
spin_lock_init(&devc->rport.lock);
init_waitqueue_head(&devc->rport.queue);