aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/maestro.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/maestro.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/maestro.c')
-rw-r--r--sound/oss/maestro.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/sound/oss/maestro.c b/sound/oss/maestro.c
index d4b569acf764..e647f2f86279 100644
--- a/sound/oss/maestro.c
+++ b/sound/oss/maestro.c
@@ -223,6 +223,8 @@
223#include <linux/reboot.h> 223#include <linux/reboot.h>
224#include <linux/bitops.h> 224#include <linux/bitops.h>
225#include <linux/wait.h> 225#include <linux/wait.h>
226#include <linux/mutex.h>
227
226 228
227#include <asm/current.h> 229#include <asm/current.h>
228#include <asm/dma.h> 230#include <asm/dma.h>
@@ -397,7 +399,7 @@ struct ess_state {
397 /* this locks around the oss state in the driver */ 399 /* this locks around the oss state in the driver */
398 spinlock_t lock; 400 spinlock_t lock;
399 /* only let 1 be opening at a time */ 401 /* only let 1 be opening at a time */
400 struct semaphore open_sem; 402 struct mutex open_mutex;
401 wait_queue_head_t open_wait; 403 wait_queue_head_t open_wait;
402 mode_t open_mode; 404 mode_t open_mode;
403 405
@@ -3020,26 +3022,26 @@ ess_open(struct inode *inode, struct file *file)
3020 VALIDATE_STATE(s); 3022 VALIDATE_STATE(s);
3021 file->private_data = s; 3023 file->private_data = s;
3022 /* wait for device to become free */ 3024 /* wait for device to become free */
3023 down(&s->open_sem); 3025 mutex_lock(&s->open_mutex);
3024 while (s->open_mode & file->f_mode) { 3026 while (s->open_mode & file->f_mode) {
3025 if (file->f_flags & O_NONBLOCK) { 3027 if (file->f_flags & O_NONBLOCK) {
3026 up(&s->open_sem); 3028 mutex_unlock(&s->open_mutex);
3027 return -EWOULDBLOCK; 3029 return -EWOULDBLOCK;
3028 } 3030 }
3029 up(&s->open_sem); 3031 mutex_unlock(&s->open_mutex);
3030 interruptible_sleep_on(&s->open_wait); 3032 interruptible_sleep_on(&s->open_wait);
3031 if (signal_pending(current)) 3033 if (signal_pending(current))
3032 return -ERESTARTSYS; 3034 return -ERESTARTSYS;
3033 down(&s->open_sem); 3035 mutex_lock(&s->open_mutex);
3034 } 3036 }
3035 3037
3036 /* under semaphore.. */ 3038 /* under semaphore.. */
3037 if ((s->card->dmapages==NULL) && allocate_buffers(s)) { 3039 if ((s->card->dmapages==NULL) && allocate_buffers(s)) {
3038 up(&s->open_sem); 3040 mutex_unlock(&s->open_mutex);
3039 return -ENOMEM; 3041 return -ENOMEM;
3040 } 3042 }
3041 3043
3042 /* we're covered by the open_sem */ 3044 /* we're covered by the open_mutex */
3043 if( ! s->card->dsps_open ) { 3045 if( ! s->card->dsps_open ) {
3044 maestro_power(s->card,ACPI_D0); 3046 maestro_power(s->card,ACPI_D0);
3045 start_bob(s); 3047 start_bob(s);
@@ -3076,7 +3078,7 @@ ess_open(struct inode *inode, struct file *file)
3076 set_fmt(s, fmtm, fmts); 3078 set_fmt(s, fmtm, fmts);
3077 s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); 3079 s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
3078 3080
3079 up(&s->open_sem); 3081 mutex_unlock(&s->open_mutex);
3080 return nonseekable_open(inode, file); 3082 return nonseekable_open(inode, file);
3081} 3083}
3082 3084
@@ -3089,7 +3091,7 @@ ess_release(struct inode *inode, struct file *file)
3089 lock_kernel(); 3091 lock_kernel();
3090 if (file->f_mode & FMODE_WRITE) 3092 if (file->f_mode & FMODE_WRITE)
3091 drain_dac(s, file->f_flags & O_NONBLOCK); 3093 drain_dac(s, file->f_flags & O_NONBLOCK);
3092 down(&s->open_sem); 3094 mutex_lock(&s->open_mutex);
3093 if (file->f_mode & FMODE_WRITE) { 3095 if (file->f_mode & FMODE_WRITE) {
3094 stop_dac(s); 3096 stop_dac(s);
3095 } 3097 }
@@ -3098,7 +3100,7 @@ ess_release(struct inode *inode, struct file *file)
3098 } 3100 }
3099 3101
3100 s->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE); 3102 s->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE);
3101 /* we're covered by the open_sem */ 3103 /* we're covered by the open_mutex */
3102 M_printk("maestro: %d dsps now alive\n",s->card->dsps_open-1); 3104 M_printk("maestro: %d dsps now alive\n",s->card->dsps_open-1);
3103 if( --s->card->dsps_open <= 0) { 3105 if( --s->card->dsps_open <= 0) {
3104 s->card->dsps_open = 0; 3106 s->card->dsps_open = 0;
@@ -3106,7 +3108,7 @@ ess_release(struct inode *inode, struct file *file)
3106 free_buffers(s); 3108 free_buffers(s);
3107 maestro_power(s->card,ACPI_D2); 3109 maestro_power(s->card,ACPI_D2);
3108 } 3110 }
3109 up(&s->open_sem); 3111 mutex_unlock(&s->open_mutex);
3110 wake_up(&s->open_wait); 3112 wake_up(&s->open_wait);
3111 unlock_kernel(); 3113 unlock_kernel();
3112 return 0; 3114 return 0;
@@ -3466,7 +3468,7 @@ maestro_probe(struct pci_dev *pcidev,const struct pci_device_id *pdid)
3466 init_waitqueue_head(&s->dma_dac.wait); 3468 init_waitqueue_head(&s->dma_dac.wait);
3467 init_waitqueue_head(&s->open_wait); 3469 init_waitqueue_head(&s->open_wait);
3468 spin_lock_init(&s->lock); 3470 spin_lock_init(&s->lock);
3469 init_MUTEX(&s->open_sem); 3471 mutex_init(&s->open_mutex);
3470 s->magic = ESS_STATE_MAGIC; 3472 s->magic = ESS_STATE_MAGIC;
3471 3473
3472 s->apu[0] = 6*i; 3474 s->apu[0] = 6*i;