X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Foss%2Fau1000.c;h=c407de86cbb6398d1d06242190e180e52df0528c;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=eacb0aef21e1831d6795225aba3b6d6cc00c46e4;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/sound/oss/au1000.c b/sound/oss/au1000.c index eacb0aef2..c407de86c 100644 --- a/sound/oss/au1000.c +++ b/sound/oss/au1000.c @@ -68,8 +68,6 @@ #include #include #include -#include - #include #include #include @@ -100,7 +98,7 @@ /* Boot options */ static int vra = 0; // 0 = no VRA, 1 = use VRA if codec supports it -module_param(vra, bool, 0); +MODULE_PARM(vra, "i"); MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); @@ -122,8 +120,8 @@ struct au1000_state { int no_vra; // do not use VRA spinlock_t lock; - struct mutex open_mutex; - struct mutex sem; + struct semaphore open_sem; + struct semaphore sem; mode_t open_mode; wait_queue_head_t open_wait; @@ -1108,7 +1106,7 @@ static ssize_t au1000_read(struct file *file, char *buffer, count *= db->cnt_factor; - mutex_lock(&s->sem); + down(&s->sem); add_wait_queue(&db->wait, &wait); while (count > 0) { @@ -1127,14 +1125,14 @@ static ssize_t au1000_read(struct file *file, char *buffer, ret = -EAGAIN; goto out; } - mutex_unlock(&s->sem); + up(&s->sem); schedule(); if (signal_pending(current)) { if (!ret) ret = -ERESTARTSYS; goto out2; } - mutex_lock(&s->sem); + down(&s->sem); } } while (avail <= 0); @@ -1161,7 +1159,7 @@ static ssize_t au1000_read(struct file *file, char *buffer, } // while (count > 0) out: - mutex_unlock(&s->sem); + up(&s->sem); out2: remove_wait_queue(&db->wait, &wait); set_current_state(TASK_RUNNING); @@ -1189,7 +1187,7 @@ static ssize_t au1000_write(struct file *file, const char *buffer, count *= db->cnt_factor; - mutex_lock(&s->sem); + down(&s->sem); add_wait_queue(&db->wait, &wait); while (count > 0) { @@ -1206,14 +1204,14 @@ static ssize_t au1000_write(struct file *file, const char *buffer, ret = -EAGAIN; goto out; } - mutex_unlock(&s->sem); + up(&s->sem); schedule(); if (signal_pending(current)) { if (!ret) ret = -ERESTARTSYS; goto out2; } - mutex_lock(&s->sem); + down(&s->sem); } } while (avail <= 0); @@ -1242,7 +1240,7 @@ static ssize_t au1000_write(struct file *file, const char *buffer, } // while (count > 0) out: - mutex_unlock(&s->sem); + up(&s->sem); out2: remove_wait_queue(&db->wait, &wait); set_current_state(TASK_RUNNING); @@ -1300,7 +1298,7 @@ static int au1000_mmap(struct file *file, struct vm_area_struct *vma) dbg("%s", __FUNCTION__); lock_kernel(); - mutex_lock(&s->sem); + down(&s->sem); if (vma->vm_flags & VM_WRITE) db = &s->dma_dac; else if (vma->vm_flags & VM_READ) @@ -1326,7 +1324,7 @@ static int au1000_mmap(struct file *file, struct vm_area_struct *vma) vma->vm_flags &= ~VM_IO; db->mapped = 1; out: - mutex_unlock(&s->sem); + up(&s->sem); unlock_kernel(); return ret; } @@ -1831,21 +1829,21 @@ static int au1000_open(struct inode *inode, struct file *file) file->private_data = s; /* wait for device to become free */ - mutex_lock(&s->open_mutex); + down(&s->open_sem); while (s->open_mode & file->f_mode) { if (file->f_flags & O_NONBLOCK) { - mutex_unlock(&s->open_mutex); + up(&s->open_sem); return -EBUSY; } add_wait_queue(&s->open_wait, &wait); __set_current_state(TASK_INTERRUPTIBLE); - mutex_unlock(&s->open_mutex); + up(&s->open_sem); schedule(); remove_wait_queue(&s->open_wait, &wait); set_current_state(TASK_RUNNING); if (signal_pending(current)) return -ERESTARTSYS; - mutex_lock(&s->open_mutex); + down(&s->open_sem); } stop_dac(s); @@ -1881,8 +1879,8 @@ static int au1000_open(struct inode *inode, struct file *file) } s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); - mutex_unlock(&s->open_mutex); - mutex_init(&s->sem); + up(&s->open_sem); + init_MUTEX(&s->sem); return nonseekable_open(inode, file); } @@ -1898,7 +1896,7 @@ static int au1000_release(struct inode *inode, struct file *file) lock_kernel(); } - mutex_lock(&s->open_mutex); + down(&s->open_sem); if (file->f_mode & FMODE_WRITE) { stop_dac(s); dealloc_dmabuf(s, &s->dma_dac); @@ -1908,7 +1906,7 @@ static int au1000_release(struct inode *inode, struct file *file) dealloc_dmabuf(s, &s->dma_adc); } s->open_mode &= ((~file->f_mode) & (FMODE_READ|FMODE_WRITE)); - mutex_unlock(&s->open_mutex); + up(&s->open_sem); wake_up(&s->open_wait); unlock_kernel(); return 0; @@ -1998,7 +1996,7 @@ static int __devinit au1000_probe(void) init_waitqueue_head(&s->dma_adc.wait); init_waitqueue_head(&s->dma_dac.wait); init_waitqueue_head(&s->open_wait); - mutex_init(&s->open_mutex); + init_MUTEX(&s->open_sem); spin_lock_init(&s->lock); s->codec.private_data = s; s->codec.id = 0;