diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-23 06:00:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:15 -0500 |
commit | f82945dff51ff7b33f69cb45a8342b936e966f7f (patch) | |
tree | d550c4b48fd13574147d09b49b1706fcf3644dc3 /sound/oss/cs4281 | |
parent | 6389a385114ae358693f213266de6468ea116c77 (diff) |
[PATCH] oss: semaphore to mutex conversion
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Extracted for OSS/Free changes from Ingo's original patches.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'sound/oss/cs4281')
-rw-r--r-- | sound/oss/cs4281/cs4281m.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/sound/oss/cs4281/cs4281m.c b/sound/oss/cs4281/cs4281m.c index 0720365f6438..0004442f9b7e 100644 --- a/sound/oss/cs4281/cs4281m.c +++ b/sound/oss/cs4281/cs4281m.c | |||
@@ -245,9 +245,9 @@ struct cs4281_state { | |||
245 | void *tmpbuff; // tmp buffer for sample conversions | 245 | void *tmpbuff; // tmp buffer for sample conversions |
246 | unsigned ena; | 246 | unsigned ena; |
247 | spinlock_t lock; | 247 | spinlock_t lock; |
248 | struct semaphore open_sem; | 248 | struct mutex open_sem; |
249 | struct semaphore open_sem_adc; | 249 | struct mutex open_sem_adc; |
250 | struct semaphore open_sem_dac; | 250 | struct mutex open_sem_dac; |
251 | mode_t open_mode; | 251 | mode_t open_mode; |
252 | wait_queue_head_t open_wait; | 252 | wait_queue_head_t open_wait; |
253 | wait_queue_head_t open_wait_adc; | 253 | wait_queue_head_t open_wait_adc; |
@@ -3598,20 +3598,20 @@ static int cs4281_release(struct inode *inode, struct file *file) | |||
3598 | 3598 | ||
3599 | if (file->f_mode & FMODE_WRITE) { | 3599 | if (file->f_mode & FMODE_WRITE) { |
3600 | drain_dac(s, file->f_flags & O_NONBLOCK); | 3600 | drain_dac(s, file->f_flags & O_NONBLOCK); |
3601 | down(&s->open_sem_dac); | 3601 | mutex_lock(&s->open_sem_dac); |
3602 | stop_dac(s); | 3602 | stop_dac(s); |
3603 | dealloc_dmabuf(s, &s->dma_dac); | 3603 | dealloc_dmabuf(s, &s->dma_dac); |
3604 | s->open_mode &= ~FMODE_WRITE; | 3604 | s->open_mode &= ~FMODE_WRITE; |
3605 | up(&s->open_sem_dac); | 3605 | mutex_unlock(&s->open_sem_dac); |
3606 | wake_up(&s->open_wait_dac); | 3606 | wake_up(&s->open_wait_dac); |
3607 | } | 3607 | } |
3608 | if (file->f_mode & FMODE_READ) { | 3608 | if (file->f_mode & FMODE_READ) { |
3609 | drain_adc(s, file->f_flags & O_NONBLOCK); | 3609 | drain_adc(s, file->f_flags & O_NONBLOCK); |
3610 | down(&s->open_sem_adc); | 3610 | mutex_lock(&s->open_sem_adc); |
3611 | stop_adc(s); | 3611 | stop_adc(s); |
3612 | dealloc_dmabuf(s, &s->dma_adc); | 3612 | dealloc_dmabuf(s, &s->dma_adc); |
3613 | s->open_mode &= ~FMODE_READ; | 3613 | s->open_mode &= ~FMODE_READ; |
3614 | up(&s->open_sem_adc); | 3614 | mutex_unlock(&s->open_sem_adc); |
3615 | wake_up(&s->open_wait_adc); | 3615 | wake_up(&s->open_wait_adc); |
3616 | } | 3616 | } |
3617 | return 0; | 3617 | return 0; |
@@ -3651,33 +3651,33 @@ static int cs4281_open(struct inode *inode, struct file *file) | |||
3651 | return -ENODEV; | 3651 | return -ENODEV; |
3652 | } | 3652 | } |
3653 | if (file->f_mode & FMODE_WRITE) { | 3653 | if (file->f_mode & FMODE_WRITE) { |
3654 | down(&s->open_sem_dac); | 3654 | mutex_lock(&s->open_sem_dac); |
3655 | while (s->open_mode & FMODE_WRITE) { | 3655 | while (s->open_mode & FMODE_WRITE) { |
3656 | if (file->f_flags & O_NONBLOCK) { | 3656 | if (file->f_flags & O_NONBLOCK) { |
3657 | up(&s->open_sem_dac); | 3657 | mutex_unlock(&s->open_sem_dac); |
3658 | return -EBUSY; | 3658 | return -EBUSY; |
3659 | } | 3659 | } |
3660 | up(&s->open_sem_dac); | 3660 | mutex_unlock(&s->open_sem_dac); |
3661 | interruptible_sleep_on(&s->open_wait_dac); | 3661 | interruptible_sleep_on(&s->open_wait_dac); |
3662 | 3662 | ||
3663 | if (signal_pending(current)) | 3663 | if (signal_pending(current)) |
3664 | return -ERESTARTSYS; | 3664 | return -ERESTARTSYS; |
3665 | down(&s->open_sem_dac); | 3665 | mutex_lock(&s->open_sem_dac); |
3666 | } | 3666 | } |
3667 | } | 3667 | } |
3668 | if (file->f_mode & FMODE_READ) { | 3668 | if (file->f_mode & FMODE_READ) { |
3669 | down(&s->open_sem_adc); | 3669 | mutex_lock(&s->open_sem_adc); |
3670 | while (s->open_mode & FMODE_READ) { | 3670 | while (s->open_mode & FMODE_READ) { |
3671 | if (file->f_flags & O_NONBLOCK) { | 3671 | if (file->f_flags & O_NONBLOCK) { |
3672 | up(&s->open_sem_adc); | 3672 | mutex_unlock(&s->open_sem_adc); |
3673 | return -EBUSY; | 3673 | return -EBUSY; |
3674 | } | 3674 | } |
3675 | up(&s->open_sem_adc); | 3675 | mutex_unlock(&s->open_sem_adc); |
3676 | interruptible_sleep_on(&s->open_wait_adc); | 3676 | interruptible_sleep_on(&s->open_wait_adc); |
3677 | 3677 | ||
3678 | if (signal_pending(current)) | 3678 | if (signal_pending(current)) |
3679 | return -ERESTARTSYS; | 3679 | return -ERESTARTSYS; |
3680 | down(&s->open_sem_adc); | 3680 | mutex_lock(&s->open_sem_adc); |
3681 | } | 3681 | } |
3682 | } | 3682 | } |
3683 | s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); | 3683 | s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); |
@@ -3691,7 +3691,7 @@ static int cs4281_open(struct inode *inode, struct file *file) | |||
3691 | s->ena &= ~FMODE_READ; | 3691 | s->ena &= ~FMODE_READ; |
3692 | s->dma_adc.ossfragshift = s->dma_adc.ossmaxfrags = | 3692 | s->dma_adc.ossfragshift = s->dma_adc.ossmaxfrags = |
3693 | s->dma_adc.subdivision = 0; | 3693 | s->dma_adc.subdivision = 0; |
3694 | up(&s->open_sem_adc); | 3694 | mutex_unlock(&s->open_sem_adc); |
3695 | 3695 | ||
3696 | if (prog_dmabuf_adc(s)) { | 3696 | if (prog_dmabuf_adc(s)) { |
3697 | CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR | 3697 | CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR |
@@ -3711,7 +3711,7 @@ static int cs4281_open(struct inode *inode, struct file *file) | |||
3711 | s->ena &= ~FMODE_WRITE; | 3711 | s->ena &= ~FMODE_WRITE; |
3712 | s->dma_dac.ossfragshift = s->dma_dac.ossmaxfrags = | 3712 | s->dma_dac.ossfragshift = s->dma_dac.ossmaxfrags = |
3713 | s->dma_dac.subdivision = 0; | 3713 | s->dma_dac.subdivision = 0; |
3714 | up(&s->open_sem_dac); | 3714 | mutex_unlock(&s->open_sem_dac); |
3715 | 3715 | ||
3716 | if (prog_dmabuf_dac(s)) { | 3716 | if (prog_dmabuf_dac(s)) { |
3717 | CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR | 3717 | CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR |
@@ -3978,17 +3978,17 @@ static int cs4281_midi_open(struct inode *inode, struct file *file) | |||
3978 | VALIDATE_STATE(s); | 3978 | VALIDATE_STATE(s); |
3979 | file->private_data = s; | 3979 | file->private_data = s; |
3980 | // wait for device to become free | 3980 | // wait for device to become free |
3981 | down(&s->open_sem); | 3981 | mutex_lock(&s->open_sem); |
3982 | while (s->open_mode & (file->f_mode << FMODE_MIDI_SHIFT)) { | 3982 | while (s->open_mode & (file->f_mode << FMODE_MIDI_SHIFT)) { |
3983 | if (file->f_flags & O_NONBLOCK) { | 3983 | if (file->f_flags & O_NONBLOCK) { |
3984 | up(&s->open_sem); | 3984 | mutex_unlock(&s->open_sem); |
3985 | return -EBUSY; | 3985 | return -EBUSY; |
3986 | } | 3986 | } |
3987 | up(&s->open_sem); | 3987 | mutex_unlock(&s->open_sem); |
3988 | interruptible_sleep_on(&s->open_wait); | 3988 | interruptible_sleep_on(&s->open_wait); |
3989 | if (signal_pending(current)) | 3989 | if (signal_pending(current)) |
3990 | return -ERESTARTSYS; | 3990 | return -ERESTARTSYS; |
3991 | down(&s->open_sem); | 3991 | mutex_lock(&s->open_sem); |
3992 | } | 3992 | } |
3993 | spin_lock_irqsave(&s->lock, flags); | 3993 | spin_lock_irqsave(&s->lock, flags); |
3994 | if (!(s->open_mode & (FMODE_MIDI_READ | FMODE_MIDI_WRITE))) { | 3994 | if (!(s->open_mode & (FMODE_MIDI_READ | FMODE_MIDI_WRITE))) { |
@@ -4018,7 +4018,7 @@ static int cs4281_midi_open(struct inode *inode, struct file *file) | |||
4018 | (file-> | 4018 | (file-> |
4019 | f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | | 4019 | f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | |
4020 | FMODE_MIDI_WRITE); | 4020 | FMODE_MIDI_WRITE); |
4021 | up(&s->open_sem); | 4021 | mutex_unlock(&s->open_sem); |
4022 | return nonseekable_open(inode, file); | 4022 | return nonseekable_open(inode, file); |
4023 | } | 4023 | } |
4024 | 4024 | ||
@@ -4057,7 +4057,7 @@ static int cs4281_midi_release(struct inode *inode, struct file *file) | |||
4057 | remove_wait_queue(&s->midi.owait, &wait); | 4057 | remove_wait_queue(&s->midi.owait, &wait); |
4058 | current->state = TASK_RUNNING; | 4058 | current->state = TASK_RUNNING; |
4059 | } | 4059 | } |
4060 | down(&s->open_sem); | 4060 | mutex_lock(&s->open_sem); |
4061 | s->open_mode &= | 4061 | s->open_mode &= |
4062 | (~(file->f_mode << FMODE_MIDI_SHIFT)) & (FMODE_MIDI_READ | | 4062 | (~(file->f_mode << FMODE_MIDI_SHIFT)) & (FMODE_MIDI_READ | |
4063 | FMODE_MIDI_WRITE); | 4063 | FMODE_MIDI_WRITE); |
@@ -4067,7 +4067,7 @@ static int cs4281_midi_release(struct inode *inode, struct file *file) | |||
4067 | del_timer(&s->midi.timer); | 4067 | del_timer(&s->midi.timer); |
4068 | } | 4068 | } |
4069 | spin_unlock_irqrestore(&s->lock, flags); | 4069 | spin_unlock_irqrestore(&s->lock, flags); |
4070 | up(&s->open_sem); | 4070 | mutex_unlock(&s->open_sem); |
4071 | wake_up(&s->open_wait); | 4071 | wake_up(&s->open_wait); |
4072 | return 0; | 4072 | return 0; |
4073 | } | 4073 | } |
@@ -4300,9 +4300,9 @@ static int __devinit cs4281_probe(struct pci_dev *pcidev, | |||
4300 | init_waitqueue_head(&s->open_wait_dac); | 4300 | init_waitqueue_head(&s->open_wait_dac); |
4301 | init_waitqueue_head(&s->midi.iwait); | 4301 | init_waitqueue_head(&s->midi.iwait); |
4302 | init_waitqueue_head(&s->midi.owait); | 4302 | init_waitqueue_head(&s->midi.owait); |
4303 | init_MUTEX(&s->open_sem); | 4303 | mutex_init(&s->open_sem); |
4304 | init_MUTEX(&s->open_sem_adc); | 4304 | mutex_init(&s->open_sem_adc); |
4305 | init_MUTEX(&s->open_sem_dac); | 4305 | mutex_init(&s->open_sem_dac); |
4306 | spin_lock_init(&s->lock); | 4306 | spin_lock_init(&s->lock); |
4307 | s->pBA0phys = pci_resource_start(pcidev, 0); | 4307 | s->pBA0phys = pci_resource_start(pcidev, 0); |
4308 | s->pBA1phys = pci_resource_start(pcidev, 1); | 4308 | s->pBA1phys = pci_resource_start(pcidev, 1); |