diff options
Diffstat (limited to 'sound/oss/btaudio.c')
| -rw-r--r-- | sound/oss/btaudio.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/sound/oss/btaudio.c b/sound/oss/btaudio.c index 4007a5680acb..bfe3b534ef30 100644 --- a/sound/oss/btaudio.c +++ b/sound/oss/btaudio.c | |||
| @@ -32,6 +32,8 @@ | |||
| 32 | #include <linux/soundcard.h> | 32 | #include <linux/soundcard.h> |
| 33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
| 34 | #include <linux/kdev_t.h> | 34 | #include <linux/kdev_t.h> |
| 35 | #include <linux/mutex.h> | ||
| 36 | |||
| 35 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
| 36 | #include <asm/io.h> | 38 | #include <asm/io.h> |
| 37 | 39 | ||
| @@ -108,7 +110,7 @@ struct btaudio { | |||
| 108 | 110 | ||
| 109 | /* locking */ | 111 | /* locking */ |
| 110 | int users; | 112 | int users; |
| 111 | struct semaphore lock; | 113 | struct mutex lock; |
| 112 | 114 | ||
| 113 | /* risc instructions */ | 115 | /* risc instructions */ |
| 114 | unsigned int risc_size; | 116 | unsigned int risc_size; |
| @@ -440,7 +442,7 @@ static struct file_operations btaudio_mixer_fops = { | |||
| 440 | static int btaudio_dsp_open(struct inode *inode, struct file *file, | 442 | static int btaudio_dsp_open(struct inode *inode, struct file *file, |
| 441 | struct btaudio *bta, int analog) | 443 | struct btaudio *bta, int analog) |
| 442 | { | 444 | { |
| 443 | down(&bta->lock); | 445 | mutex_lock(&bta->lock); |
| 444 | if (bta->users) | 446 | if (bta->users) |
| 445 | goto busy; | 447 | goto busy; |
| 446 | bta->users++; | 448 | bta->users++; |
| @@ -452,11 +454,11 @@ static int btaudio_dsp_open(struct inode *inode, struct file *file, | |||
| 452 | bta->read_count = 0; | 454 | bta->read_count = 0; |
| 453 | bta->sampleshift = 0; | 455 | bta->sampleshift = 0; |
| 454 | 456 | ||
| 455 | up(&bta->lock); | 457 | mutex_unlock(&bta->lock); |
| 456 | return 0; | 458 | return 0; |
| 457 | 459 | ||
| 458 | busy: | 460 | busy: |
| 459 | up(&bta->lock); | 461 | mutex_unlock(&bta->lock); |
| 460 | return -EBUSY; | 462 | return -EBUSY; |
| 461 | } | 463 | } |
| 462 | 464 | ||
| @@ -496,11 +498,11 @@ static int btaudio_dsp_release(struct inode *inode, struct file *file) | |||
| 496 | { | 498 | { |
| 497 | struct btaudio *bta = file->private_data; | 499 | struct btaudio *bta = file->private_data; |
| 498 | 500 | ||
| 499 | down(&bta->lock); | 501 | mutex_lock(&bta->lock); |
| 500 | if (bta->recording) | 502 | if (bta->recording) |
| 501 | stop_recording(bta); | 503 | stop_recording(bta); |
| 502 | bta->users--; | 504 | bta->users--; |
| 503 | up(&bta->lock); | 505 | mutex_unlock(&bta->lock); |
| 504 | return 0; | 506 | return 0; |
| 505 | } | 507 | } |
| 506 | 508 | ||
| @@ -513,7 +515,7 @@ static ssize_t btaudio_dsp_read(struct file *file, char __user *buffer, | |||
| 513 | DECLARE_WAITQUEUE(wait, current); | 515 | DECLARE_WAITQUEUE(wait, current); |
| 514 | 516 | ||
| 515 | add_wait_queue(&bta->readq, &wait); | 517 | add_wait_queue(&bta->readq, &wait); |
| 516 | down(&bta->lock); | 518 | mutex_lock(&bta->lock); |
| 517 | while (swcount > 0) { | 519 | while (swcount > 0) { |
| 518 | if (0 == bta->read_count) { | 520 | if (0 == bta->read_count) { |
| 519 | if (!bta->recording) { | 521 | if (!bta->recording) { |
| @@ -528,10 +530,10 @@ static ssize_t btaudio_dsp_read(struct file *file, char __user *buffer, | |||
| 528 | ret = -EAGAIN; | 530 | ret = -EAGAIN; |
| 529 | break; | 531 | break; |
| 530 | } | 532 | } |
| 531 | up(&bta->lock); | 533 | mutex_unlock(&bta->lock); |
| 532 | current->state = TASK_INTERRUPTIBLE; | 534 | current->state = TASK_INTERRUPTIBLE; |
| 533 | schedule(); | 535 | schedule(); |
| 534 | down(&bta->lock); | 536 | mutex_lock(&bta->lock); |
| 535 | if(signal_pending(current)) { | 537 | if(signal_pending(current)) { |
| 536 | if (0 == ret) | 538 | if (0 == ret) |
| 537 | ret = -EINTR; | 539 | ret = -EINTR; |
| @@ -604,7 +606,7 @@ static ssize_t btaudio_dsp_read(struct file *file, char __user *buffer, | |||
| 604 | if (bta->read_offset == bta->buf_size) | 606 | if (bta->read_offset == bta->buf_size) |
| 605 | bta->read_offset = 0; | 607 | bta->read_offset = 0; |
| 606 | } | 608 | } |
| 607 | up(&bta->lock); | 609 | mutex_unlock(&bta->lock); |
| 608 | remove_wait_queue(&bta->readq, &wait); | 610 | remove_wait_queue(&bta->readq, &wait); |
| 609 | current->state = TASK_RUNNING; | 611 | current->state = TASK_RUNNING; |
| 610 | return ret; | 612 | return ret; |
| @@ -651,10 +653,10 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file, | |||
| 651 | bta->decimation = 0; | 653 | bta->decimation = 0; |
| 652 | } | 654 | } |
| 653 | if (bta->recording) { | 655 | if (bta->recording) { |
| 654 | down(&bta->lock); | 656 | mutex_lock(&bta->lock); |
| 655 | stop_recording(bta); | 657 | stop_recording(bta); |
| 656 | start_recording(bta); | 658 | start_recording(bta); |
| 657 | up(&bta->lock); | 659 | mutex_unlock(&bta->lock); |
| 658 | } | 660 | } |
| 659 | /* fall through */ | 661 | /* fall through */ |
| 660 | case SOUND_PCM_READ_RATE: | 662 | case SOUND_PCM_READ_RATE: |
| @@ -716,10 +718,10 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file, | |||
| 716 | else | 718 | else |
| 717 | bta->bits = 16; | 719 | bta->bits = 16; |
| 718 | if (bta->recording) { | 720 | if (bta->recording) { |
| 719 | down(&bta->lock); | 721 | mutex_lock(&bta->lock); |
| 720 | stop_recording(bta); | 722 | stop_recording(bta); |
| 721 | start_recording(bta); | 723 | start_recording(bta); |
| 722 | up(&bta->lock); | 724 | mutex_unlock(&bta->lock); |
| 723 | } | 725 | } |
| 724 | } | 726 | } |
| 725 | if (debug) | 727 | if (debug) |
| @@ -736,9 +738,9 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file, | |||
| 736 | 738 | ||
| 737 | case SNDCTL_DSP_RESET: | 739 | case SNDCTL_DSP_RESET: |
| 738 | if (bta->recording) { | 740 | if (bta->recording) { |
| 739 | down(&bta->lock); | 741 | mutex_lock(&bta->lock); |
| 740 | stop_recording(bta); | 742 | stop_recording(bta); |
| 741 | up(&bta->lock); | 743 | mutex_unlock(&bta->lock); |
| 742 | } | 744 | } |
| 743 | return 0; | 745 | return 0; |
| 744 | case SNDCTL_DSP_GETBLKSIZE: | 746 | case SNDCTL_DSP_GETBLKSIZE: |
| @@ -941,7 +943,7 @@ static int __devinit btaudio_probe(struct pci_dev *pci_dev, | |||
| 941 | if (rate) | 943 | if (rate) |
| 942 | bta->rate = rate; | 944 | bta->rate = rate; |
| 943 | 945 | ||
| 944 | init_MUTEX(&bta->lock); | 946 | mutex_init(&bta->lock); |
| 945 | init_waitqueue_head(&bta->readq); | 947 | init_waitqueue_head(&bta->readq); |
| 946 | 948 | ||
| 947 | if (-1 != latency) { | 949 | if (-1 != latency) { |
