aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/rme96xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/oss/rme96xx.c')
-rw-r--r--sound/oss/rme96xx.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sound/oss/rme96xx.c b/sound/oss/rme96xx.c
index faa0b7919b65..a1ec9d131ab3 100644
--- a/sound/oss/rme96xx.c
+++ b/sound/oss/rme96xx.c
@@ -58,6 +58,7 @@ TODO:
58#include <linux/interrupt.h> 58#include <linux/interrupt.h>
59#include <linux/poll.h> 59#include <linux/poll.h>
60#include <linux/wait.h> 60#include <linux/wait.h>
61#include <linux/mutex.h>
61 62
62#include <asm/dma.h> 63#include <asm/dma.h>
63#include <asm/page.h> 64#include <asm/page.h>
@@ -326,7 +327,7 @@ typedef struct _rme96xx_info {
326 327
327 /* waiting and locking */ 328 /* waiting and locking */
328 wait_queue_head_t wait; 329 wait_queue_head_t wait;
329 struct semaphore open_sem; 330 struct mutex open_mutex;
330 wait_queue_head_t open_wait; 331 wait_queue_head_t open_wait;
331 332
332 } dma[RME96xx_MAX_DEVS]; 333 } dma[RME96xx_MAX_DEVS];
@@ -842,7 +843,7 @@ static void busmaster_free(void* ptr,int size) {
842 843
843static int rme96xx_dmabuf_init(rme96xx_info * s,struct dmabuf* dma,int ioffset,int ooffset) { 844static int rme96xx_dmabuf_init(rme96xx_info * s,struct dmabuf* dma,int ioffset,int ooffset) {
844 845
845 init_MUTEX(&dma->open_sem); 846 mutex_init(&dma->open_mutex);
846 init_waitqueue_head(&dma->open_wait); 847 init_waitqueue_head(&dma->open_wait);
847 init_waitqueue_head(&dma->wait); 848 init_waitqueue_head(&dma->wait);
848 dma->s = s; 849 dma->s = s;
@@ -1469,21 +1470,21 @@ static int rme96xx_open(struct inode *in, struct file *f)
1469 dma = &s->dma[devnum]; 1470 dma = &s->dma[devnum];
1470 f->private_data = dma; 1471 f->private_data = dma;
1471 /* wait for device to become free */ 1472 /* wait for device to become free */
1472 down(&dma->open_sem); 1473 mutex_lock(&dma->open_mutex);
1473 while (dma->open_mode & f->f_mode) { 1474 while (dma->open_mode & f->f_mode) {
1474 if (f->f_flags & O_NONBLOCK) { 1475 if (f->f_flags & O_NONBLOCK) {
1475 up(&dma->open_sem); 1476 mutex_unlock(&dma->open_mutex);
1476 return -EBUSY; 1477 return -EBUSY;
1477 } 1478 }
1478 add_wait_queue(&dma->open_wait, &wait); 1479 add_wait_queue(&dma->open_wait, &wait);
1479 __set_current_state(TASK_INTERRUPTIBLE); 1480 __set_current_state(TASK_INTERRUPTIBLE);
1480 up(&dma->open_sem); 1481 mutex_unlock(&dma->open_mutex);
1481 schedule(); 1482 schedule();
1482 remove_wait_queue(&dma->open_wait, &wait); 1483 remove_wait_queue(&dma->open_wait, &wait);
1483 set_current_state(TASK_RUNNING); 1484 set_current_state(TASK_RUNNING);
1484 if (signal_pending(current)) 1485 if (signal_pending(current))
1485 return -ERESTARTSYS; 1486 return -ERESTARTSYS;
1486 down(&dma->open_sem); 1487 mutex_lock(&dma->open_mutex);
1487 } 1488 }
1488 1489
1489 COMM ("hardware open") 1490 COMM ("hardware open")
@@ -1492,7 +1493,7 @@ static int rme96xx_open(struct inode *in, struct file *f)
1492 1493
1493 dma->open_mode |= (f->f_mode & (FMODE_READ | FMODE_WRITE)); 1494 dma->open_mode |= (f->f_mode & (FMODE_READ | FMODE_WRITE));
1494 dma->opened = 1; 1495 dma->opened = 1;
1495 up(&dma->open_sem); 1496 mutex_unlock(&dma->open_mutex);
1496 1497
1497 DBG(printk("device num %d open finished\n",devnum)); 1498 DBG(printk("device num %d open finished\n",devnum));
1498 return 0; 1499 return 0;
@@ -1524,7 +1525,7 @@ static int rme96xx_release(struct inode *in, struct file *file)
1524 } 1525 }
1525 1526
1526 wake_up(&dma->open_wait); 1527 wake_up(&dma->open_wait);
1527 up(&dma->open_sem); 1528 mutex_unlock(&dma->open_mutex);
1528 1529
1529 return 0; 1530 return 0;
1530} 1531}