diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-23 06:00:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:13 -0500 |
commit | 910f5d202ce39cc78de1bbb679285a3167de9fb2 (patch) | |
tree | 2c5b55c2b141aaf016c459beb397fc702c41b967 /sound/oss/cmpci.c | |
parent | 82d4dc5adb0055393248ad4ab8de392fac708a12 (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/cmpci.c')
-rw-r--r-- | sound/oss/cmpci.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sound/oss/cmpci.c b/sound/oss/cmpci.c index 7cfbb08db537..1fbd5137f6d7 100644 --- a/sound/oss/cmpci.c +++ b/sound/oss/cmpci.c | |||
@@ -138,6 +138,8 @@ | |||
138 | #endif | 138 | #endif |
139 | #ifdef CONFIG_SOUND_CMPCI_JOYSTICK | 139 | #ifdef CONFIG_SOUND_CMPCI_JOYSTICK |
140 | #include <linux/gameport.h> | 140 | #include <linux/gameport.h> |
141 | #include <linux/mutex.h> | ||
142 | |||
141 | #endif | 143 | #endif |
142 | 144 | ||
143 | /* --------------------------------------------------------------------- */ | 145 | /* --------------------------------------------------------------------- */ |
@@ -392,7 +394,7 @@ struct cm_state { | |||
392 | unsigned char fmt, enable; | 394 | unsigned char fmt, enable; |
393 | 395 | ||
394 | spinlock_t lock; | 396 | spinlock_t lock; |
395 | struct semaphore open_sem; | 397 | struct mutex open_mutex; |
396 | mode_t open_mode; | 398 | mode_t open_mode; |
397 | wait_queue_head_t open_wait; | 399 | wait_queue_head_t open_wait; |
398 | 400 | ||
@@ -2825,21 +2827,21 @@ static int cm_open(struct inode *inode, struct file *file) | |||
2825 | VALIDATE_STATE(s); | 2827 | VALIDATE_STATE(s); |
2826 | file->private_data = s; | 2828 | file->private_data = s; |
2827 | /* wait for device to become free */ | 2829 | /* wait for device to become free */ |
2828 | down(&s->open_sem); | 2830 | mutex_lock(&s->open_mutex); |
2829 | while (s->open_mode & file->f_mode) { | 2831 | while (s->open_mode & file->f_mode) { |
2830 | if (file->f_flags & O_NONBLOCK) { | 2832 | if (file->f_flags & O_NONBLOCK) { |
2831 | up(&s->open_sem); | 2833 | mutex_unlock(&s->open_mutex); |
2832 | return -EBUSY; | 2834 | return -EBUSY; |
2833 | } | 2835 | } |
2834 | add_wait_queue(&s->open_wait, &wait); | 2836 | add_wait_queue(&s->open_wait, &wait); |
2835 | __set_current_state(TASK_INTERRUPTIBLE); | 2837 | __set_current_state(TASK_INTERRUPTIBLE); |
2836 | up(&s->open_sem); | 2838 | mutex_unlock(&s->open_mutex); |
2837 | schedule(); | 2839 | schedule(); |
2838 | remove_wait_queue(&s->open_wait, &wait); | 2840 | remove_wait_queue(&s->open_wait, &wait); |
2839 | set_current_state(TASK_RUNNING); | 2841 | set_current_state(TASK_RUNNING); |
2840 | if (signal_pending(current)) | 2842 | if (signal_pending(current)) |
2841 | return -ERESTARTSYS; | 2843 | return -ERESTARTSYS; |
2842 | down(&s->open_sem); | 2844 | mutex_lock(&s->open_mutex); |
2843 | } | 2845 | } |
2844 | if (file->f_mode & FMODE_READ) { | 2846 | if (file->f_mode & FMODE_READ) { |
2845 | s->status &= ~DO_BIGENDIAN_R; | 2847 | s->status &= ~DO_BIGENDIAN_R; |
@@ -2867,7 +2869,7 @@ static int cm_open(struct inode *inode, struct file *file) | |||
2867 | } | 2869 | } |
2868 | set_fmt(s, fmtm, fmts); | 2870 | set_fmt(s, fmtm, fmts); |
2869 | s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); | 2871 | s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); |
2870 | up(&s->open_sem); | 2872 | mutex_unlock(&s->open_mutex); |
2871 | return nonseekable_open(inode, file); | 2873 | return nonseekable_open(inode, file); |
2872 | } | 2874 | } |
2873 | 2875 | ||
@@ -2879,7 +2881,7 @@ static int cm_release(struct inode *inode, struct file *file) | |||
2879 | lock_kernel(); | 2881 | lock_kernel(); |
2880 | if (file->f_mode & FMODE_WRITE) | 2882 | if (file->f_mode & FMODE_WRITE) |
2881 | drain_dac(s, file->f_flags & O_NONBLOCK); | 2883 | drain_dac(s, file->f_flags & O_NONBLOCK); |
2882 | down(&s->open_sem); | 2884 | mutex_lock(&s->open_mutex); |
2883 | if (file->f_mode & FMODE_WRITE) { | 2885 | if (file->f_mode & FMODE_WRITE) { |
2884 | stop_dac(s); | 2886 | stop_dac(s); |
2885 | 2887 | ||
@@ -2903,7 +2905,7 @@ static int cm_release(struct inode *inode, struct file *file) | |||
2903 | s->status &= ~DO_BIGENDIAN_R; | 2905 | s->status &= ~DO_BIGENDIAN_R; |
2904 | } | 2906 | } |
2905 | s->open_mode &= ~(file->f_mode & (FMODE_READ|FMODE_WRITE)); | 2907 | s->open_mode &= ~(file->f_mode & (FMODE_READ|FMODE_WRITE)); |
2906 | up(&s->open_sem); | 2908 | mutex_unlock(&s->open_mutex); |
2907 | wake_up(&s->open_wait); | 2909 | wake_up(&s->open_wait); |
2908 | unlock_kernel(); | 2910 | unlock_kernel(); |
2909 | return 0; | 2911 | return 0; |
@@ -3080,7 +3082,7 @@ static int __devinit cm_probe(struct pci_dev *pcidev, const struct pci_device_id | |||
3080 | init_waitqueue_head(&s->dma_adc.wait); | 3082 | init_waitqueue_head(&s->dma_adc.wait); |
3081 | init_waitqueue_head(&s->dma_dac.wait); | 3083 | init_waitqueue_head(&s->dma_dac.wait); |
3082 | init_waitqueue_head(&s->open_wait); | 3084 | init_waitqueue_head(&s->open_wait); |
3083 | init_MUTEX(&s->open_sem); | 3085 | mutex_init(&s->open_mutex); |
3084 | spin_lock_init(&s->lock); | 3086 | spin_lock_init(&s->lock); |
3085 | s->magic = CM_MAGIC; | 3087 | s->magic = CM_MAGIC; |
3086 | s->dev = pcidev; | 3088 | s->dev = pcidev; |