aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-23 06:00:47 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 10:38:15 -0500
commitf82945dff51ff7b33f69cb45a8342b936e966f7f (patch)
treed550c4b48fd13574147d09b49b1706fcf3644dc3
parent6389a385114ae358693f213266de6468ea116c77 (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>
-rw-r--r--sound/oss/ac97_codec.c24
-rw-r--r--sound/oss/cs4281/cs4281m.c54
-rw-r--r--sound/oss/dmasound/dmasound_awacs.c10
-rw-r--r--sound/oss/emu10k1/hwaccess.h2
-rw-r--r--sound/oss/emu10k1/main.c2
-rw-r--r--sound/oss/emu10k1/midi.c14
6 files changed, 53 insertions, 53 deletions
diff --git a/sound/oss/ac97_codec.c b/sound/oss/ac97_codec.c
index fd25aca25120..972327c97644 100644
--- a/sound/oss/ac97_codec.c
+++ b/sound/oss/ac97_codec.c
@@ -55,7 +55,7 @@
55#include <linux/pci.h> 55#include <linux/pci.h>
56#include <linux/ac97_codec.h> 56#include <linux/ac97_codec.h>
57#include <asm/uaccess.h> 57#include <asm/uaccess.h>
58#include <asm/semaphore.h> 58#include <linux/mutex.h>
59 59
60#define CODEC_ID_BUFSZ 14 60#define CODEC_ID_BUFSZ 14
61 61
@@ -304,7 +304,7 @@ static const unsigned int ac97_oss_rm[] = {
304 304
305static LIST_HEAD(codecs); 305static LIST_HEAD(codecs);
306static LIST_HEAD(codec_drivers); 306static LIST_HEAD(codec_drivers);
307static DECLARE_MUTEX(codec_sem); 307static DEFINE_MUTEX(codec_mutex);
308 308
309/* reads the given OSS mixer from the ac97 the caller must have insured that the ac97 knows 309/* reads the given OSS mixer from the ac97 the caller must have insured that the ac97 knows
310 about that given mixer, and should be holding a spinlock for the card */ 310 about that given mixer, and should be holding a spinlock for the card */
@@ -769,9 +769,9 @@ void ac97_release_codec(struct ac97_codec *codec)
769{ 769{
770 /* Remove from the list first, we don't want to be 770 /* Remove from the list first, we don't want to be
771 "rediscovered" */ 771 "rediscovered" */
772 down(&codec_sem); 772 mutex_lock(&codec_mutex);
773 list_del(&codec->list); 773 list_del(&codec->list);
774 up(&codec_sem); 774 mutex_unlock(&codec_mutex);
775 /* 775 /*
776 * The driver needs to deal with internal 776 * The driver needs to deal with internal
777 * locking to avoid accidents here. 777 * locking to avoid accidents here.
@@ -889,7 +889,7 @@ int ac97_probe_codec(struct ac97_codec *codec)
889 * callbacks. 889 * callbacks.
890 */ 890 */
891 891
892 down(&codec_sem); 892 mutex_lock(&codec_mutex);
893 list_add(&codec->list, &codecs); 893 list_add(&codec->list, &codecs);
894 894
895 list_for_each(l, &codec_drivers) { 895 list_for_each(l, &codec_drivers) {
@@ -903,7 +903,7 @@ int ac97_probe_codec(struct ac97_codec *codec)
903 } 903 }
904 } 904 }
905 905
906 up(&codec_sem); 906 mutex_unlock(&codec_mutex);
907 return 1; 907 return 1;
908} 908}
909 909
@@ -1439,7 +1439,7 @@ int ac97_register_driver(struct ac97_driver *driver)
1439 struct list_head *l; 1439 struct list_head *l;
1440 struct ac97_codec *c; 1440 struct ac97_codec *c;
1441 1441
1442 down(&codec_sem); 1442 mutex_lock(&codec_mutex);
1443 INIT_LIST_HEAD(&driver->list); 1443 INIT_LIST_HEAD(&driver->list);
1444 list_add(&driver->list, &codec_drivers); 1444 list_add(&driver->list, &codec_drivers);
1445 1445
@@ -1452,7 +1452,7 @@ int ac97_register_driver(struct ac97_driver *driver)
1452 continue; 1452 continue;
1453 c->driver = driver; 1453 c->driver = driver;
1454 } 1454 }
1455 up(&codec_sem); 1455 mutex_unlock(&codec_mutex);
1456 return 0; 1456 return 0;
1457} 1457}
1458 1458
@@ -1471,7 +1471,7 @@ void ac97_unregister_driver(struct ac97_driver *driver)
1471 struct list_head *l; 1471 struct list_head *l;
1472 struct ac97_codec *c; 1472 struct ac97_codec *c;
1473 1473
1474 down(&codec_sem); 1474 mutex_lock(&codec_mutex);
1475 list_del_init(&driver->list); 1475 list_del_init(&driver->list);
1476 1476
1477 list_for_each(l, &codecs) 1477 list_for_each(l, &codecs)
@@ -1483,7 +1483,7 @@ void ac97_unregister_driver(struct ac97_driver *driver)
1483 } 1483 }
1484 } 1484 }
1485 1485
1486 up(&codec_sem); 1486 mutex_unlock(&codec_mutex);
1487} 1487}
1488 1488
1489EXPORT_SYMBOL_GPL(ac97_unregister_driver); 1489EXPORT_SYMBOL_GPL(ac97_unregister_driver);
@@ -1494,14 +1494,14 @@ static int swap_headphone(int remove_master)
1494 struct ac97_codec *c; 1494 struct ac97_codec *c;
1495 1495
1496 if (remove_master) { 1496 if (remove_master) {
1497 down(&codec_sem); 1497 mutex_lock(&codec_mutex);
1498 list_for_each(l, &codecs) 1498 list_for_each(l, &codecs)
1499 { 1499 {
1500 c = list_entry(l, struct ac97_codec, list); 1500 c = list_entry(l, struct ac97_codec, list);
1501 if (supported_mixer(c, SOUND_MIXER_PHONEOUT)) 1501 if (supported_mixer(c, SOUND_MIXER_PHONEOUT))
1502 c->supported_mixers &= ~SOUND_MASK_PHONEOUT; 1502 c->supported_mixers &= ~SOUND_MASK_PHONEOUT;
1503 } 1503 }
1504 up(&codec_sem); 1504 mutex_unlock(&codec_mutex);
1505 } else 1505 } else
1506 ac97_hw[SOUND_MIXER_PHONEOUT].offset = AC97_MASTER_VOL_STEREO; 1506 ac97_hw[SOUND_MIXER_PHONEOUT].offset = AC97_MASTER_VOL_STEREO;
1507 1507
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);
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c
index 74f975676ccb..a17375141c3a 100644
--- a/sound/oss/dmasound/dmasound_awacs.c
+++ b/sound/oss/dmasound/dmasound_awacs.c
@@ -80,7 +80,7 @@
80#include <linux/kmod.h> 80#include <linux/kmod.h>
81#include <linux/interrupt.h> 81#include <linux/interrupt.h>
82#include <linux/input.h> 82#include <linux/input.h>
83#include <asm/semaphore.h> 83#include <linux/mutex.h>
84#ifdef CONFIG_ADB_CUDA 84#ifdef CONFIG_ADB_CUDA
85#include <linux/cuda.h> 85#include <linux/cuda.h>
86#endif 86#endif
@@ -130,7 +130,7 @@ static struct resource awacs_rsrc[3];
130static char awacs_name[64]; 130static char awacs_name[64];
131static int awacs_revision; 131static int awacs_revision;
132static int awacs_sleeping; 132static int awacs_sleeping;
133static DECLARE_MUTEX(dmasound_sem); 133static DEFINE_MUTEX(dmasound_mutex);
134 134
135static int sound_device_id; /* exists after iMac revA */ 135static int sound_device_id; /* exists after iMac revA */
136static int hw_can_byteswap = 1 ; /* most pmac sound h/w can */ 136static int hw_can_byteswap = 1 ; /* most pmac sound h/w can */
@@ -312,11 +312,11 @@ extern int daca_enter_sleep(void);
312extern int daca_leave_sleep(void); 312extern int daca_leave_sleep(void);
313 313
314#define TRY_LOCK() \ 314#define TRY_LOCK() \
315 if ((rc = down_interruptible(&dmasound_sem)) != 0) \ 315 if ((rc = mutex_lock_interruptible(&dmasound_mutex)) != 0) \
316 return rc; 316 return rc;
317#define LOCK() down(&dmasound_sem); 317#define LOCK() mutex_lock(&dmasound_mutex);
318 318
319#define UNLOCK() up(&dmasound_sem); 319#define UNLOCK() mutex_unlock(&dmasound_mutex);
320 320
321/* We use different versions that the ones provided in dmasound.h 321/* We use different versions that the ones provided in dmasound.h
322 * 322 *
diff --git a/sound/oss/emu10k1/hwaccess.h b/sound/oss/emu10k1/hwaccess.h
index 104223a192aa..85e27bda694b 100644
--- a/sound/oss/emu10k1/hwaccess.h
+++ b/sound/oss/emu10k1/hwaccess.h
@@ -181,7 +181,7 @@ struct emu10k1_card
181 struct emu10k1_mpuout *mpuout; 181 struct emu10k1_mpuout *mpuout;
182 struct emu10k1_mpuin *mpuin; 182 struct emu10k1_mpuin *mpuin;
183 183
184 struct semaphore open_sem; 184 struct mutex open_sem;
185 mode_t open_mode; 185 mode_t open_mode;
186 wait_queue_head_t open_wait; 186 wait_queue_head_t open_wait;
187 187
diff --git a/sound/oss/emu10k1/main.c b/sound/oss/emu10k1/main.c
index 23241cbdd90f..0cd44a6f7ac0 100644
--- a/sound/oss/emu10k1/main.c
+++ b/sound/oss/emu10k1/main.c
@@ -1320,7 +1320,7 @@ static int __devinit emu10k1_probe(struct pci_dev *pci_dev, const struct pci_dev
1320 card->is_aps = (subsysvid == EMU_APS_SUBID); 1320 card->is_aps = (subsysvid == EMU_APS_SUBID);
1321 1321
1322 spin_lock_init(&card->lock); 1322 spin_lock_init(&card->lock);
1323 init_MUTEX(&card->open_sem); 1323 mutex_init(&card->open_sem);
1324 card->open_mode = 0; 1324 card->open_mode = 0;
1325 init_waitqueue_head(&card->open_wait); 1325 init_waitqueue_head(&card->open_wait);
1326 1326
diff --git a/sound/oss/emu10k1/midi.c b/sound/oss/emu10k1/midi.c
index b40b5f97aace..959a96794dba 100644
--- a/sound/oss/emu10k1/midi.c
+++ b/sound/oss/emu10k1/midi.c
@@ -110,21 +110,21 @@ match:
110#endif 110#endif
111 111
112 /* Wait for device to become free */ 112 /* Wait for device to become free */
113 down(&card->open_sem); 113 mutex_lock(&card->open_sem);
114 while (card->open_mode & (file->f_mode << FMODE_MIDI_SHIFT)) { 114 while (card->open_mode & (file->f_mode << FMODE_MIDI_SHIFT)) {
115 if (file->f_flags & O_NONBLOCK) { 115 if (file->f_flags & O_NONBLOCK) {
116 up(&card->open_sem); 116 mutex_unlock(&card->open_sem);
117 return -EBUSY; 117 return -EBUSY;
118 } 118 }
119 119
120 up(&card->open_sem); 120 mutex_unlock(&card->open_sem);
121 interruptible_sleep_on(&card->open_wait); 121 interruptible_sleep_on(&card->open_wait);
122 122
123 if (signal_pending(current)) { 123 if (signal_pending(current)) {
124 return -ERESTARTSYS; 124 return -ERESTARTSYS;
125 } 125 }
126 126
127 down(&card->open_sem); 127 mutex_lock(&card->open_sem);
128 } 128 }
129 129
130 if ((midi_dev = (struct emu10k1_mididevice *) kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL) 130 if ((midi_dev = (struct emu10k1_mididevice *) kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL)
@@ -183,7 +183,7 @@ match:
183 183
184 card->open_mode |= (file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE); 184 card->open_mode |= (file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE);
185 185
186 up(&card->open_sem); 186 mutex_unlock(&card->open_sem);
187 187
188 return nonseekable_open(inode, file); 188 return nonseekable_open(inode, file);
189} 189}
@@ -234,9 +234,9 @@ static int emu10k1_midi_release(struct inode *inode, struct file *file)
234 234
235 kfree(midi_dev); 235 kfree(midi_dev);
236 236
237 down(&card->open_sem); 237 mutex_lock(&card->open_sem);
238 card->open_mode &= ~((file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE)); 238 card->open_mode &= ~((file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE));
239 up(&card->open_sem); 239 mutex_unlock(&card->open_sem);
240 wake_up_interruptible(&card->open_wait); 240 wake_up_interruptible(&card->open_wait);
241 241
242 unlock_kernel(); 242 unlock_kernel();