aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/via82cxxx_audio.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/via82cxxx_audio.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/via82cxxx_audio.c')
-rw-r--r--sound/oss/via82cxxx_audio.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c
index 83edda93f0b4..1a921ee71aba 100644
--- a/sound/oss/via82cxxx_audio.c
+++ b/sound/oss/via82cxxx_audio.c
@@ -38,7 +38,8 @@
38#include <linux/dma-mapping.h> 38#include <linux/dma-mapping.h>
39#include <asm/io.h> 39#include <asm/io.h>
40#include <asm/uaccess.h> 40#include <asm/uaccess.h>
41#include <asm/semaphore.h> 41#include <linux/mutex.h>
42
42#include "sound_config.h" 43#include "sound_config.h"
43#include "dev_table.h" 44#include "dev_table.h"
44#include "mpu401.h" 45#include "mpu401.h"
@@ -311,8 +312,8 @@ struct via_info {
311 312
312 int mixer_vol; /* 8233/35 volume - not yet implemented */ 313 int mixer_vol; /* 8233/35 volume - not yet implemented */
313 314
314 struct semaphore syscall_sem; 315 struct mutex syscall_mutex;
315 struct semaphore open_sem; 316 struct mutex open_mutex;
316 317
317 /* The 8233/8235 have 4 DX audio channels, two record and 318 /* The 8233/8235 have 4 DX audio channels, two record and
318 one six channel out. We bind ch_in to DX 1, ch_out to multichannel 319 one six channel out. We bind ch_in to DX 1, ch_out to multichannel
@@ -505,10 +506,10 @@ static inline int via_syscall_down (struct via_info *card, int nonblock)
505 nonblock = 0; 506 nonblock = 0;
506 507
507 if (nonblock) { 508 if (nonblock) {
508 if (down_trylock (&card->syscall_sem)) 509 if (!mutex_trylock(&card->syscall_mutex))
509 return -EAGAIN; 510 return -EAGAIN;
510 } else { 511 } else {
511 if (down_interruptible (&card->syscall_sem)) 512 if (mutex_lock_interruptible(&card->syscall_mutex))
512 return -ERESTARTSYS; 513 return -ERESTARTSYS;
513 } 514 }
514 515
@@ -1609,7 +1610,7 @@ static int via_mixer_ioctl (struct inode *inode, struct file *file, unsigned int
1609#endif 1610#endif
1610 rc = codec->mixer_ioctl(codec, cmd, arg); 1611 rc = codec->mixer_ioctl(codec, cmd, arg);
1611 1612
1612 up (&card->syscall_sem); 1613 mutex_unlock(&card->syscall_mutex);
1613 1614
1614out: 1615out:
1615 DPRINTK ("EXIT, returning %d\n", rc); 1616 DPRINTK ("EXIT, returning %d\n", rc);
@@ -2228,7 +2229,7 @@ static int via_dsp_mmap(struct file *file, struct vm_area_struct *vma)
2228 if (wr) 2229 if (wr)
2229 card->ch_out.is_mapped = 1; 2230 card->ch_out.is_mapped = 1;
2230 2231
2231 up (&card->syscall_sem); 2232 mutex_unlock(&card->syscall_mutex);
2232 rc = 0; 2233 rc = 0;
2233 2234
2234out: 2235out:
@@ -2256,7 +2257,7 @@ handle_one_block:
2256 /* Thomas Sailer: 2257 /* Thomas Sailer:
2257 * But also to ourselves, release semaphore if we do so */ 2258 * But also to ourselves, release semaphore if we do so */
2258 if (need_resched()) { 2259 if (need_resched()) {
2259 up(&card->syscall_sem); 2260 mutex_unlock(&card->syscall_mutex);
2260 schedule (); 2261 schedule ();
2261 ret = via_syscall_down (card, nonblock); 2262 ret = via_syscall_down (card, nonblock);
2262 if (ret) 2263 if (ret)
@@ -2286,7 +2287,7 @@ handle_one_block:
2286 break; 2287 break;
2287 } 2288 }
2288 2289
2289 up(&card->syscall_sem); 2290 mutex_unlock(&card->syscall_mutex);
2290 2291
2291 DPRINTK ("Sleeping on block %d\n", n); 2292 DPRINTK ("Sleeping on block %d\n", n);
2292 schedule(); 2293 schedule();
@@ -2402,7 +2403,7 @@ static ssize_t via_dsp_read(struct file *file, char __user *buffer, size_t count
2402 rc = via_dsp_do_read (card, buffer, count, nonblock); 2403 rc = via_dsp_do_read (card, buffer, count, nonblock);
2403 2404
2404out_up: 2405out_up:
2405 up (&card->syscall_sem); 2406 mutex_unlock(&card->syscall_mutex);
2406out: 2407out:
2407 DPRINTK ("EXIT, returning %ld\n",(long) rc); 2408 DPRINTK ("EXIT, returning %ld\n",(long) rc);
2408 return rc; 2409 return rc;
@@ -2426,7 +2427,7 @@ handle_one_block:
2426 /* Thomas Sailer: 2427 /* Thomas Sailer:
2427 * But also to ourselves, release semaphore if we do so */ 2428 * But also to ourselves, release semaphore if we do so */
2428 if (need_resched()) { 2429 if (need_resched()) {
2429 up(&card->syscall_sem); 2430 mutex_unlock(&card->syscall_mutex);
2430 schedule (); 2431 schedule ();
2431 ret = via_syscall_down (card, nonblock); 2432 ret = via_syscall_down (card, nonblock);
2432 if (ret) 2433 if (ret)
@@ -2456,7 +2457,7 @@ handle_one_block:
2456 break; 2457 break;
2457 } 2458 }
2458 2459
2459 up(&card->syscall_sem); 2460 mutex_unlock(&card->syscall_mutex);
2460 2461
2461 DPRINTK ("Sleeping on page %d, tmp==%d, ir==%d\n", n, tmp, chan->is_record); 2462 DPRINTK ("Sleeping on page %d, tmp==%d, ir==%d\n", n, tmp, chan->is_record);
2462 schedule(); 2463 schedule();
@@ -2585,7 +2586,7 @@ static ssize_t via_dsp_write(struct file *file, const char __user *buffer, size_
2585 rc = via_dsp_do_write (card, buffer, count, nonblock); 2586 rc = via_dsp_do_write (card, buffer, count, nonblock);
2586 2587
2587out_up: 2588out_up:
2588 up (&card->syscall_sem); 2589 mutex_unlock(&card->syscall_mutex);
2589out: 2590out:
2590 DPRINTK ("EXIT, returning %ld\n",(long) rc); 2591 DPRINTK ("EXIT, returning %ld\n",(long) rc);
2591 return rc; 2592 return rc;
@@ -2634,7 +2635,7 @@ static unsigned int via_dsp_poll(struct file *file, struct poll_table_struct *wa
2634 * Sleeps until all playback has been flushed to the audio 2635 * Sleeps until all playback has been flushed to the audio
2635 * hardware. 2636 * hardware.
2636 * 2637 *
2637 * Locking: inside card->syscall_sem 2638 * Locking: inside card->syscall_mutex
2638 */ 2639 */
2639 2640
2640static int via_dsp_drain_playback (struct via_info *card, 2641static int via_dsp_drain_playback (struct via_info *card,
@@ -2692,7 +2693,7 @@ static int via_dsp_drain_playback (struct via_info *card,
2692 printk (KERN_ERR "sleeping but not active\n"); 2693 printk (KERN_ERR "sleeping but not active\n");
2693#endif 2694#endif
2694 2695
2695 up(&card->syscall_sem); 2696 mutex_unlock(&card->syscall_mutex);
2696 2697
2697 DPRINTK ("sleeping, nbufs=%d\n", atomic_read (&chan->n_frags)); 2698 DPRINTK ("sleeping, nbufs=%d\n", atomic_read (&chan->n_frags));
2698 schedule(); 2699 schedule();
@@ -2748,7 +2749,7 @@ out:
2748 * 2749 *
2749 * Handles SNDCTL_DSP_GETISPACE and SNDCTL_DSP_GETOSPACE. 2750 * Handles SNDCTL_DSP_GETISPACE and SNDCTL_DSP_GETOSPACE.
2750 * 2751 *
2751 * Locking: inside card->syscall_sem 2752 * Locking: inside card->syscall_mutex
2752 */ 2753 */
2753 2754
2754static int via_dsp_ioctl_space (struct via_info *card, 2755static int via_dsp_ioctl_space (struct via_info *card,
@@ -2793,7 +2794,7 @@ static int via_dsp_ioctl_space (struct via_info *card,
2793 * 2794 *
2794 * Handles SNDCTL_DSP_GETIPTR and SNDCTL_DSP_GETOPTR. 2795 * Handles SNDCTL_DSP_GETIPTR and SNDCTL_DSP_GETOPTR.
2795 * 2796 *
2796 * Locking: inside card->syscall_sem 2797 * Locking: inside card->syscall_mutex
2797 */ 2798 */
2798 2799
2799static int via_dsp_ioctl_ptr (struct via_info *card, 2800static int via_dsp_ioctl_ptr (struct via_info *card,
@@ -3221,7 +3222,7 @@ static int via_dsp_ioctl (struct inode *inode, struct file *file,
3221 break; 3222 break;
3222 } 3223 }
3223 3224
3224 up (&card->syscall_sem); 3225 mutex_unlock(&card->syscall_mutex);
3225 DPRINTK ("EXIT, returning %d\n", rc); 3226 DPRINTK ("EXIT, returning %d\n", rc);
3226 return rc; 3227 return rc;
3227} 3228}
@@ -3264,12 +3265,12 @@ static int via_dsp_open (struct inode *inode, struct file *file)
3264 3265
3265match: 3266match:
3266 if (nonblock) { 3267 if (nonblock) {
3267 if (down_trylock (&card->open_sem)) { 3268 if (!mutex_trylock(&card->open_mutex)) {
3268 DPRINTK ("EXIT, returning -EAGAIN\n"); 3269 DPRINTK ("EXIT, returning -EAGAIN\n");
3269 return -EAGAIN; 3270 return -EAGAIN;
3270 } 3271 }
3271 } else { 3272 } else {
3272 if (down_interruptible (&card->open_sem)) { 3273 if (mutex_lock_interruptible(&card->open_mutex)) {
3273 DPRINTK ("EXIT, returning -ERESTARTSYS\n"); 3274 DPRINTK ("EXIT, returning -ERESTARTSYS\n");
3274 return -ERESTARTSYS; 3275 return -ERESTARTSYS;
3275 } 3276 }
@@ -3355,8 +3356,8 @@ static int via_dsp_release(struct inode *inode, struct file *file)
3355 via_chan_buffer_free (card, &card->ch_in); 3356 via_chan_buffer_free (card, &card->ch_in);
3356 } 3357 }
3357 3358
3358 up (&card->syscall_sem); 3359 mutex_unlock(&card->syscall_mutex);
3359 up (&card->open_sem); 3360 mutex_unlock(&card->open_mutex);
3360 3361
3361 DPRINTK ("EXIT, returning 0\n"); 3362 DPRINTK ("EXIT, returning 0\n");
3362 return 0; 3363 return 0;
@@ -3414,8 +3415,8 @@ static int __devinit via_init_one (struct pci_dev *pdev, const struct pci_device
3414 card->card_num = via_num_cards++; 3415 card->card_num = via_num_cards++;
3415 spin_lock_init (&card->lock); 3416 spin_lock_init (&card->lock);
3416 spin_lock_init (&card->ac97_lock); 3417 spin_lock_init (&card->ac97_lock);
3417 init_MUTEX (&card->syscall_sem); 3418 mutex_init(&card->syscall_mutex);
3418 init_MUTEX (&card->open_sem); 3419 mutex_init(&card->open_mutex);
3419 3420
3420 /* we must init these now, in case the intr handler needs them */ 3421 /* we must init these now, in case the intr handler needs them */
3421 via_chan_init_defaults (card, &card->ch_out); 3422 via_chan_init_defaults (card, &card->ch_out);