aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/swarm_cs4297a.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/swarm_cs4297a.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/swarm_cs4297a.c')
-rw-r--r--sound/oss/swarm_cs4297a.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c
index df4d3771fa84..dce9016cbcfd 100644
--- a/sound/oss/swarm_cs4297a.c
+++ b/sound/oss/swarm_cs4297a.c
@@ -76,6 +76,7 @@
76#include <linux/init.h> 76#include <linux/init.h>
77#include <linux/poll.h> 77#include <linux/poll.h>
78#include <linux/smp_lock.h> 78#include <linux/smp_lock.h>
79#include <linux/mutex.h>
79 80
80#include <asm/byteorder.h> 81#include <asm/byteorder.h>
81#include <asm/dma.h> 82#include <asm/dma.h>
@@ -291,9 +292,9 @@ struct cs4297a_state {
291 unsigned conversion:1; // conversion from 16 to 8 bit in progress 292 unsigned conversion:1; // conversion from 16 to 8 bit in progress
292 unsigned ena; 293 unsigned ena;
293 spinlock_t lock; 294 spinlock_t lock;
294 struct semaphore open_sem; 295 struct mutex open_mutex;
295 struct semaphore open_sem_adc; 296 struct mutex open_sem_adc;
296 struct semaphore open_sem_dac; 297 struct mutex open_sem_dac;
297 mode_t open_mode; 298 mode_t open_mode;
298 wait_queue_head_t open_wait; 299 wait_queue_head_t open_wait;
299 wait_queue_head_t open_wait_adc; 300 wait_queue_head_t open_wait_adc;
@@ -2352,20 +2353,20 @@ static int cs4297a_release(struct inode *inode, struct file *file)
2352 2353
2353 if (file->f_mode & FMODE_WRITE) { 2354 if (file->f_mode & FMODE_WRITE) {
2354 drain_dac(s, file->f_flags & O_NONBLOCK); 2355 drain_dac(s, file->f_flags & O_NONBLOCK);
2355 down(&s->open_sem_dac); 2356 mutex_lock(&s->open_sem_dac);
2356 stop_dac(s); 2357 stop_dac(s);
2357 dealloc_dmabuf(s, &s->dma_dac); 2358 dealloc_dmabuf(s, &s->dma_dac);
2358 s->open_mode &= ~FMODE_WRITE; 2359 s->open_mode &= ~FMODE_WRITE;
2359 up(&s->open_sem_dac); 2360 mutex_unlock(&s->open_sem_dac);
2360 wake_up(&s->open_wait_dac); 2361 wake_up(&s->open_wait_dac);
2361 } 2362 }
2362 if (file->f_mode & FMODE_READ) { 2363 if (file->f_mode & FMODE_READ) {
2363 drain_adc(s, file->f_flags & O_NONBLOCK); 2364 drain_adc(s, file->f_flags & O_NONBLOCK);
2364 down(&s->open_sem_adc); 2365 mutex_lock(&s->open_sem_adc);
2365 stop_adc(s); 2366 stop_adc(s);
2366 dealloc_dmabuf(s, &s->dma_adc); 2367 dealloc_dmabuf(s, &s->dma_adc);
2367 s->open_mode &= ~FMODE_READ; 2368 s->open_mode &= ~FMODE_READ;
2368 up(&s->open_sem_adc); 2369 mutex_unlock(&s->open_sem_adc);
2369 wake_up(&s->open_wait_adc); 2370 wake_up(&s->open_wait_adc);
2370 } 2371 }
2371 return 0; 2372 return 0;
@@ -2413,37 +2414,37 @@ static int cs4297a_open(struct inode *inode, struct file *file)
2413 ; 2414 ;
2414 } 2415 }
2415 2416
2416 down(&s->open_sem_dac); 2417 mutex_lock(&s->open_sem_dac);
2417 while (s->open_mode & FMODE_WRITE) { 2418 while (s->open_mode & FMODE_WRITE) {
2418 if (file->f_flags & O_NONBLOCK) { 2419 if (file->f_flags & O_NONBLOCK) {
2419 up(&s->open_sem_dac); 2420 mutex_unlock(&s->open_sem_dac);
2420 return -EBUSY; 2421 return -EBUSY;
2421 } 2422 }
2422 up(&s->open_sem_dac); 2423 mutex_unlock(&s->open_sem_dac);
2423 interruptible_sleep_on(&s->open_wait_dac); 2424 interruptible_sleep_on(&s->open_wait_dac);
2424 2425
2425 if (signal_pending(current)) { 2426 if (signal_pending(current)) {
2426 printk("open - sig pending\n"); 2427 printk("open - sig pending\n");
2427 return -ERESTARTSYS; 2428 return -ERESTARTSYS;
2428 } 2429 }
2429 down(&s->open_sem_dac); 2430 mutex_lock(&s->open_sem_dac);
2430 } 2431 }
2431 } 2432 }
2432 if (file->f_mode & FMODE_READ) { 2433 if (file->f_mode & FMODE_READ) {
2433 down(&s->open_sem_adc); 2434 mutex_lock(&s->open_sem_adc);
2434 while (s->open_mode & FMODE_READ) { 2435 while (s->open_mode & FMODE_READ) {
2435 if (file->f_flags & O_NONBLOCK) { 2436 if (file->f_flags & O_NONBLOCK) {
2436 up(&s->open_sem_adc); 2437 mutex_unlock(&s->open_sem_adc);
2437 return -EBUSY; 2438 return -EBUSY;
2438 } 2439 }
2439 up(&s->open_sem_adc); 2440 mutex_unlock(&s->open_sem_adc);
2440 interruptible_sleep_on(&s->open_wait_adc); 2441 interruptible_sleep_on(&s->open_wait_adc);
2441 2442
2442 if (signal_pending(current)) { 2443 if (signal_pending(current)) {
2443 printk("open - sig pending\n"); 2444 printk("open - sig pending\n");
2444 return -ERESTARTSYS; 2445 return -ERESTARTSYS;
2445 } 2446 }
2446 down(&s->open_sem_adc); 2447 mutex_lock(&s->open_sem_adc);
2447 } 2448 }
2448 } 2449 }
2449 s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); 2450 s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
@@ -2456,7 +2457,7 @@ static int cs4297a_open(struct inode *inode, struct file *file)
2456 s->ena &= ~FMODE_READ; 2457 s->ena &= ~FMODE_READ;
2457 s->dma_adc.ossfragshift = s->dma_adc.ossmaxfrags = 2458 s->dma_adc.ossfragshift = s->dma_adc.ossmaxfrags =
2458 s->dma_adc.subdivision = 0; 2459 s->dma_adc.subdivision = 0;
2459 up(&s->open_sem_adc); 2460 mutex_unlock(&s->open_sem_adc);
2460 2461
2461 if (prog_dmabuf_adc(s)) { 2462 if (prog_dmabuf_adc(s)) {
2462 CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR 2463 CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR
@@ -2474,7 +2475,7 @@ static int cs4297a_open(struct inode *inode, struct file *file)
2474 s->ena &= ~FMODE_WRITE; 2475 s->ena &= ~FMODE_WRITE;
2475 s->dma_dac.ossfragshift = s->dma_dac.ossmaxfrags = 2476 s->dma_dac.ossfragshift = s->dma_dac.ossmaxfrags =
2476 s->dma_dac.subdivision = 0; 2477 s->dma_dac.subdivision = 0;
2477 up(&s->open_sem_dac); 2478 mutex_unlock(&s->open_sem_dac);
2478 2479
2479 if (prog_dmabuf_dac(s)) { 2480 if (prog_dmabuf_dac(s)) {
2480 CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR 2481 CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR
@@ -2631,8 +2632,8 @@ static int __init cs4297a_init(void)
2631 init_waitqueue_head(&s->open_wait); 2632 init_waitqueue_head(&s->open_wait);
2632 init_waitqueue_head(&s->open_wait_adc); 2633 init_waitqueue_head(&s->open_wait_adc);
2633 init_waitqueue_head(&s->open_wait_dac); 2634 init_waitqueue_head(&s->open_wait_dac);
2634 init_MUTEX(&s->open_sem_adc); 2635 mutex_init(&s->open_sem_adc);
2635 init_MUTEX(&s->open_sem_dac); 2636 mutex_init(&s->open_sem_dac);
2636 spin_lock_init(&s->lock); 2637 spin_lock_init(&s->lock);
2637 2638
2638 s->irq = K_INT_SER_1; 2639 s->irq = K_INT_SER_1;