Commit ef9f0a42db987e7e2df72289fb4522d24027786b

Authored by Ingo Molnar
Committed by Jaroslav Kysela
1 parent 1a60d4c5a0

[ALSA] semaphore -> mutex (driver part)

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: Takashi Iwai <tiwai@suse.de>

Showing 22 changed files with 103 additions and 99 deletions Side-by-side Diff

include/sound/emux_synth.h
... ... @@ -113,7 +113,7 @@
113 113 struct snd_emux_voice *voices; /* Voices (EMU 'channel') */
114 114 int use_time; /* allocation counter */
115 115 spinlock_t voice_lock; /* Lock for voice access */
116   - struct semaphore register_mutex;
  116 + struct mutex register_mutex;
117 117 int client; /* For the sequencer client */
118 118 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */
119 119 struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS];
... ... @@ -55,7 +55,7 @@
55 55 struct snd_card *card; /* card which I2C belongs to */
56 56 char name[32]; /* some useful label */
57 57  
58   - struct semaphore lock_mutex;
  58 + struct mutex lock_mutex;
59 59  
60 60 struct snd_i2c_bus *master; /* master bus when SCK/SCL is shared */
61 61 struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */
62 62  
63 63  
64 64  
... ... @@ -84,17 +84,17 @@
84 84 static inline void snd_i2c_lock(struct snd_i2c_bus *bus)
85 85 {
86 86 if (bus->master)
87   - down(&bus->master->lock_mutex);
  87 + mutex_lock(&bus->master->lock_mutex);
88 88 else
89   - down(&bus->lock_mutex);
  89 + mutex_lock(&bus->lock_mutex);
90 90 }
91 91  
92 92 static inline void snd_i2c_unlock(struct snd_i2c_bus *bus)
93 93 {
94 94 if (bus->master)
95   - up(&bus->master->lock_mutex);
  95 + mutex_unlock(&bus->master->lock_mutex);
96 96 else
97   - up(&bus->lock_mutex);
  97 + mutex_unlock(&bus->lock_mutex);
98 98 }
99 99  
100 100 int snd_i2c_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count);
include/sound/opl3.h
... ... @@ -53,6 +53,7 @@
53 53  
54 54 #include "driver.h"
55 55 #include <linux/time.h>
  56 +#include <linux/mutex.h>
56 57 #include "core.h"
57 58 #include "hwdep.h"
58 59 #include "timer.h"
... ... @@ -312,7 +313,7 @@
312 313 int sys_timer_status; /* system timer run status */
313 314 spinlock_t sys_timer_lock; /* Lock for system timer access */
314 315 #endif
315   - struct semaphore access_mutex; /* locking */
  316 + struct mutex access_mutex; /* locking */
316 317 };
317 318  
318 319 /* opl3.c */
include/sound/soundfont.h
... ... @@ -93,7 +93,7 @@
93 93 int sample_locked; /* locked time for sample */
94 94 struct snd_sf_callback callback; /* callback functions */
95 95 int presets_locked;
96   - struct semaphore presets_mutex;
  96 + struct mutex presets_mutex;
97 97 spinlock_t lock;
98 98 struct snd_util_memhdr *memhdr;
99 99 };
include/sound/util_mem.h
1 1 #ifndef __SOUND_UTIL_MEM_H
2 2 #define __SOUND_UTIL_MEM_H
  3 +
  4 +#include <linux/mutex.h>
3 5 /*
4 6 * Copyright (C) 2000 Takashi Iwai <tiwai@suse.de>
5 7 *
... ... @@ -40,7 +42,7 @@
40 42 int nblocks; /* # of allocated blocks */
41 43 unsigned int used; /* used memory size */
42 44 int block_extra_size; /* extra data size of chunk */
43   - struct semaphore block_mutex; /* lock */
  45 + struct mutex block_mutex; /* lock */
44 46 };
45 47  
46 48 /*
include/sound/vx_core.h
... ... @@ -206,7 +206,7 @@
206 206 int audio_monitor[4]; /* playback hw-monitor level */
207 207 unsigned char audio_monitor_active[4]; /* playback hw-monitor mute/unmute */
208 208  
209   - struct semaphore mixer_mutex;
  209 + struct mutex mixer_mutex;
210 210  
211 211 const struct firmware *firmware[4]; /* loaded firmware data */
212 212 };
sound/drivers/opl3/opl3_lib.c
... ... @@ -358,7 +358,7 @@
358 358 opl3->hardware = hardware;
359 359 spin_lock_init(&opl3->reg_lock);
360 360 spin_lock_init(&opl3->timer_lock);
361   - init_MUTEX(&opl3->access_mutex);
  361 + mutex_init(&opl3->access_mutex);
362 362  
363 363 if ((err = snd_device_new(card, SNDRV_DEV_CODEC, opl3, &ops)) < 0) {
364 364 snd_opl3_free(opl3);
sound/drivers/opl3/opl3_seq.c
... ... @@ -52,13 +52,13 @@
52 52 {
53 53 int idx;
54 54  
55   - down(&opl3->access_mutex);
  55 + mutex_lock(&opl3->access_mutex);
56 56 if (opl3->used) {
57   - up(&opl3->access_mutex);
  57 + mutex_unlock(&opl3->access_mutex);
58 58 return -EBUSY;
59 59 }
60 60 opl3->used++;
61   - up(&opl3->access_mutex);
  61 + mutex_unlock(&opl3->access_mutex);
62 62  
63 63 snd_opl3_reset(opl3);
64 64  
65 65  
... ... @@ -91,9 +91,9 @@
91 91 spin_unlock_irqrestore(&opl3->sys_timer_lock, flags);
92 92  
93 93 snd_opl3_reset(opl3);
94   - down(&opl3->access_mutex);
  94 + mutex_lock(&opl3->access_mutex);
95 95 opl3->used--;
96   - up(&opl3->access_mutex);
  96 + mutex_unlock(&opl3->access_mutex);
97 97 }
98 98  
99 99 static int snd_opl3_synth_use(void *private_data, struct snd_seq_port_subscribe * info)
sound/drivers/opl3/opl3_synth.c
... ... @@ -76,13 +76,13 @@
76 76 {
77 77 struct snd_opl3 *opl3 = hw->private_data;
78 78  
79   - down(&opl3->access_mutex);
  79 + mutex_lock(&opl3->access_mutex);
80 80 if (opl3->used) {
81   - up(&opl3->access_mutex);
  81 + mutex_unlock(&opl3->access_mutex);
82 82 return -EAGAIN;
83 83 }
84 84 opl3->used++;
85   - up(&opl3->access_mutex);
  85 + mutex_unlock(&opl3->access_mutex);
86 86  
87 87 return 0;
88 88 }
89 89  
... ... @@ -179,9 +179,9 @@
179 179 struct snd_opl3 *opl3 = hw->private_data;
180 180  
181 181 snd_opl3_reset(opl3);
182   - down(&opl3->access_mutex);
  182 + mutex_lock(&opl3->access_mutex);
183 183 opl3->used--;
184   - up(&opl3->access_mutex);
  184 + mutex_unlock(&opl3->access_mutex);
185 185  
186 186 return 0;
187 187 }
sound/drivers/opl4/opl4_lib.c
... ... @@ -214,7 +214,7 @@
214 214 opl4->fm_port = fm_port;
215 215 opl4->pcm_port = pcm_port;
216 216 spin_lock_init(&opl4->reg_lock);
217   - init_MUTEX(&opl4->access_mutex);
  217 + mutex_init(&opl4->access_mutex);
218 218  
219 219 err = snd_opl4_detect(opl4);
220 220 if (err < 0) {
sound/drivers/opl4/opl4_local.h
... ... @@ -182,7 +182,7 @@
182 182 struct snd_info_entry *proc_entry;
183 183 int memory_access;
184 184 #endif
185   - struct semaphore access_mutex;
  185 + struct mutex access_mutex;
186 186  
187 187 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
188 188 int used;
sound/drivers/opl4/opl4_proc.c
... ... @@ -28,13 +28,13 @@
28 28 {
29 29 struct snd_opl4 *opl4 = entry->private_data;
30 30  
31   - down(&opl4->access_mutex);
  31 + mutex_lock(&opl4->access_mutex);
32 32 if (opl4->memory_access) {
33   - up(&opl4->access_mutex);
  33 + mutex_unlock(&opl4->access_mutex);
34 34 return -EBUSY;
35 35 }
36 36 opl4->memory_access++;
37   - up(&opl4->access_mutex);
  37 + mutex_unlock(&opl4->access_mutex);
38 38 return 0;
39 39 }
40 40  
41 41  
... ... @@ -43,9 +43,9 @@
43 43 {
44 44 struct snd_opl4 *opl4 = entry->private_data;
45 45  
46   - down(&opl4->access_mutex);
  46 + mutex_lock(&opl4->access_mutex);
47 47 opl4->memory_access--;
48   - up(&opl4->access_mutex);
  48 + mutex_unlock(&opl4->access_mutex);
49 49 return 0;
50 50 }
51 51  
sound/drivers/opl4/opl4_seq.c
... ... @@ -62,10 +62,10 @@
62 62 struct snd_opl4 *opl4 = private_data;
63 63 int err;
64 64  
65   - down(&opl4->access_mutex);
  65 + mutex_lock(&opl4->access_mutex);
66 66  
67 67 if (opl4->used) {
68   - up(&opl4->access_mutex);
  68 + mutex_unlock(&opl4->access_mutex);
69 69 return -EBUSY;
70 70 }
71 71 opl4->used++;
72 72  
... ... @@ -73,12 +73,12 @@
73 73 if (info->sender.client != SNDRV_SEQ_CLIENT_SYSTEM) {
74 74 err = snd_opl4_seq_use_inc(opl4);
75 75 if (err < 0) {
76   - up(&opl4->access_mutex);
  76 + mutex_unlock(&opl4->access_mutex);
77 77 return err;
78 78 }
79 79 }
80 80  
81   - up(&opl4->access_mutex);
  81 + mutex_unlock(&opl4->access_mutex);
82 82  
83 83 snd_opl4_synth_reset(opl4);
84 84 return 0;
85 85  
... ... @@ -90,9 +90,9 @@
90 90  
91 91 snd_opl4_synth_shutdown(opl4);
92 92  
93   - down(&opl4->access_mutex);
  93 + mutex_lock(&opl4->access_mutex);
94 94 opl4->used--;
95   - up(&opl4->access_mutex);
  95 + mutex_unlock(&opl4->access_mutex);
96 96  
97 97 if (info->sender.client != SNDRV_SEQ_CLIENT_SYSTEM)
98 98 snd_opl4_seq_use_dec(opl4);
sound/drivers/vx/vx_core.c
... ... @@ -778,7 +778,7 @@
778 778 chip->type = hw->type;
779 779 chip->ops = ops;
780 780 tasklet_init(&chip->tq, vx_interrupt, (unsigned long)chip);
781   - init_MUTEX(&chip->mixer_mutex);
  781 + mutex_init(&chip->mixer_mutex);
782 782  
783 783 chip->card = card;
784 784 card->private_data = chip;
sound/drivers/vx/vx_mixer.c
... ... @@ -427,10 +427,10 @@
427 427 {
428 428 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
429 429 int codec = kcontrol->id.index;
430   - down(&chip->mixer_mutex);
  430 + mutex_lock(&chip->mixer_mutex);
431 431 ucontrol->value.integer.value[0] = chip->output_level[codec][0];
432 432 ucontrol->value.integer.value[1] = chip->output_level[codec][1];
433   - up(&chip->mixer_mutex);
  433 + mutex_unlock(&chip->mixer_mutex);
434 434 return 0;
435 435 }
436 436  
... ... @@ -438,7 +438,7 @@
438 438 {
439 439 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
440 440 int codec = kcontrol->id.index;
441   - down(&chip->mixer_mutex);
  441 + mutex_lock(&chip->mixer_mutex);
442 442 if (ucontrol->value.integer.value[0] != chip->output_level[codec][0] ||
443 443 ucontrol->value.integer.value[1] != chip->output_level[codec][1]) {
444 444 vx_set_analog_output_level(chip, codec,
445 445  
... ... @@ -446,10 +446,10 @@
446 446 ucontrol->value.integer.value[1]);
447 447 chip->output_level[codec][0] = ucontrol->value.integer.value[0];
448 448 chip->output_level[codec][1] = ucontrol->value.integer.value[1];
449   - up(&chip->mixer_mutex);
  449 + mutex_unlock(&chip->mixer_mutex);
450 450 return 1;
451 451 }
452   - up(&chip->mixer_mutex);
  452 + mutex_unlock(&chip->mixer_mutex);
453 453 return 0;
454 454 }
455 455  
456 456  
457 457  
... ... @@ -502,14 +502,14 @@
502 502 static int vx_audio_src_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
503 503 {
504 504 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
505   - down(&chip->mixer_mutex);
  505 + mutex_lock(&chip->mixer_mutex);
506 506 if (chip->audio_source_target != ucontrol->value.enumerated.item[0]) {
507 507 chip->audio_source_target = ucontrol->value.enumerated.item[0];
508 508 vx_sync_audio_source(chip);
509   - up(&chip->mixer_mutex);
  509 + mutex_unlock(&chip->mixer_mutex);
510 510 return 1;
511 511 }
512   - up(&chip->mixer_mutex);
  512 + mutex_unlock(&chip->mixer_mutex);
513 513 return 0;
514 514 }
515 515  
516 516  
517 517  
... ... @@ -550,14 +550,14 @@
550 550 static int vx_clock_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
551 551 {
552 552 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
553   - down(&chip->mixer_mutex);
  553 + mutex_lock(&chip->mixer_mutex);
554 554 if (chip->clock_mode != ucontrol->value.enumerated.item[0]) {
555 555 chip->clock_mode = ucontrol->value.enumerated.item[0];
556 556 vx_set_clock(chip, chip->freq);
557   - up(&chip->mixer_mutex);
  557 + mutex_unlock(&chip->mixer_mutex);
558 558 return 1;
559 559 }
560   - up(&chip->mixer_mutex);
  560 + mutex_unlock(&chip->mixer_mutex);
561 561 return 0;
562 562 }
563 563  
564 564  
... ... @@ -587,10 +587,10 @@
587 587 int audio = kcontrol->private_value & 0xff;
588 588 int capture = (kcontrol->private_value >> 8) & 1;
589 589  
590   - down(&chip->mixer_mutex);
  590 + mutex_lock(&chip->mixer_mutex);
591 591 ucontrol->value.integer.value[0] = chip->audio_gain[capture][audio];
592 592 ucontrol->value.integer.value[1] = chip->audio_gain[capture][audio+1];
593   - up(&chip->mixer_mutex);
  593 + mutex_unlock(&chip->mixer_mutex);
594 594 return 0;
595 595 }
596 596  
597 597  
598 598  
... ... @@ -600,15 +600,15 @@
600 600 int audio = kcontrol->private_value & 0xff;
601 601 int capture = (kcontrol->private_value >> 8) & 1;
602 602  
603   - down(&chip->mixer_mutex);
  603 + mutex_lock(&chip->mixer_mutex);
604 604 if (ucontrol->value.integer.value[0] != chip->audio_gain[capture][audio] ||
605 605 ucontrol->value.integer.value[1] != chip->audio_gain[capture][audio+1]) {
606 606 vx_set_audio_gain(chip, audio, capture, ucontrol->value.integer.value[0]);
607 607 vx_set_audio_gain(chip, audio+1, capture, ucontrol->value.integer.value[1]);
608   - up(&chip->mixer_mutex);
  608 + mutex_unlock(&chip->mixer_mutex);
609 609 return 1;
610 610 }
611   - up(&chip->mixer_mutex);
  611 + mutex_unlock(&chip->mixer_mutex);
612 612 return 0;
613 613 }
614 614  
615 615  
... ... @@ -617,10 +617,10 @@
617 617 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
618 618 int audio = kcontrol->private_value & 0xff;
619 619  
620   - down(&chip->mixer_mutex);
  620 + mutex_lock(&chip->mixer_mutex);
621 621 ucontrol->value.integer.value[0] = chip->audio_monitor[audio];
622 622 ucontrol->value.integer.value[1] = chip->audio_monitor[audio+1];
623   - up(&chip->mixer_mutex);
  623 + mutex_unlock(&chip->mixer_mutex);
624 624 return 0;
625 625 }
626 626  
627 627  
628 628  
... ... @@ -629,17 +629,17 @@
629 629 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
630 630 int audio = kcontrol->private_value & 0xff;
631 631  
632   - down(&chip->mixer_mutex);
  632 + mutex_lock(&chip->mixer_mutex);
633 633 if (ucontrol->value.integer.value[0] != chip->audio_monitor[audio] ||
634 634 ucontrol->value.integer.value[1] != chip->audio_monitor[audio+1]) {
635 635 vx_set_monitor_level(chip, audio, ucontrol->value.integer.value[0],
636 636 chip->audio_monitor_active[audio]);
637 637 vx_set_monitor_level(chip, audio+1, ucontrol->value.integer.value[1],
638 638 chip->audio_monitor_active[audio+1]);
639   - up(&chip->mixer_mutex);
  639 + mutex_unlock(&chip->mixer_mutex);
640 640 return 1;
641 641 }
642   - up(&chip->mixer_mutex);
  642 + mutex_unlock(&chip->mixer_mutex);
643 643 return 0;
644 644 }
645 645  
646 646  
... ... @@ -657,10 +657,10 @@
657 657 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
658 658 int audio = kcontrol->private_value & 0xff;
659 659  
660   - down(&chip->mixer_mutex);
  660 + mutex_lock(&chip->mixer_mutex);
661 661 ucontrol->value.integer.value[0] = chip->audio_active[audio];
662 662 ucontrol->value.integer.value[1] = chip->audio_active[audio+1];
663   - up(&chip->mixer_mutex);
  663 + mutex_unlock(&chip->mixer_mutex);
664 664 return 0;
665 665 }
666 666  
667 667  
668 668  
... ... @@ -669,15 +669,15 @@
669 669 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
670 670 int audio = kcontrol->private_value & 0xff;
671 671  
672   - down(&chip->mixer_mutex);
  672 + mutex_lock(&chip->mixer_mutex);
673 673 if (ucontrol->value.integer.value[0] != chip->audio_active[audio] ||
674 674 ucontrol->value.integer.value[1] != chip->audio_active[audio+1]) {
675 675 vx_set_audio_switch(chip, audio, ucontrol->value.integer.value[0]);
676 676 vx_set_audio_switch(chip, audio+1, ucontrol->value.integer.value[1]);
677   - up(&chip->mixer_mutex);
  677 + mutex_unlock(&chip->mixer_mutex);
678 678 return 1;
679 679 }
680   - up(&chip->mixer_mutex);
  680 + mutex_unlock(&chip->mixer_mutex);
681 681 return 0;
682 682 }
683 683  
684 684  
... ... @@ -686,10 +686,10 @@
686 686 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
687 687 int audio = kcontrol->private_value & 0xff;
688 688  
689   - down(&chip->mixer_mutex);
  689 + mutex_lock(&chip->mixer_mutex);
690 690 ucontrol->value.integer.value[0] = chip->audio_monitor_active[audio];
691 691 ucontrol->value.integer.value[1] = chip->audio_monitor_active[audio+1];
692   - up(&chip->mixer_mutex);
  692 + mutex_unlock(&chip->mixer_mutex);
693 693 return 0;
694 694 }
695 695  
696 696  
697 697  
... ... @@ -698,17 +698,17 @@
698 698 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
699 699 int audio = kcontrol->private_value & 0xff;
700 700  
701   - down(&chip->mixer_mutex);
  701 + mutex_lock(&chip->mixer_mutex);
702 702 if (ucontrol->value.integer.value[0] != chip->audio_monitor_active[audio] ||
703 703 ucontrol->value.integer.value[1] != chip->audio_monitor_active[audio+1]) {
704 704 vx_set_monitor_level(chip, audio, chip->audio_monitor[audio],
705 705 ucontrol->value.integer.value[0]);
706 706 vx_set_monitor_level(chip, audio+1, chip->audio_monitor[audio+1],
707 707 ucontrol->value.integer.value[1]);
708   - up(&chip->mixer_mutex);
  708 + mutex_unlock(&chip->mixer_mutex);
709 709 return 1;
710 710 }
711   - up(&chip->mixer_mutex);
  711 + mutex_unlock(&chip->mixer_mutex);
712 712 return 0;
713 713 }
714 714  
715 715  
... ... @@ -756,12 +756,12 @@
756 756 {
757 757 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
758 758  
759   - down(&chip->mixer_mutex);
  759 + mutex_lock(&chip->mixer_mutex);
760 760 ucontrol->value.iec958.status[0] = (chip->uer_bits >> 0) & 0xff;
761 761 ucontrol->value.iec958.status[1] = (chip->uer_bits >> 8) & 0xff;
762 762 ucontrol->value.iec958.status[2] = (chip->uer_bits >> 16) & 0xff;
763 763 ucontrol->value.iec958.status[3] = (chip->uer_bits >> 24) & 0xff;
764   - up(&chip->mixer_mutex);
  764 + mutex_unlock(&chip->mixer_mutex);
765 765 return 0;
766 766 }
767 767  
768 768  
769 769  
... ... @@ -783,14 +783,14 @@
783 783 (ucontrol->value.iec958.status[1] << 8) |
784 784 (ucontrol->value.iec958.status[2] << 16) |
785 785 (ucontrol->value.iec958.status[3] << 24);
786   - down(&chip->mixer_mutex);
  786 + mutex_lock(&chip->mixer_mutex);
787 787 if (chip->uer_bits != val) {
788 788 chip->uer_bits = val;
789 789 vx_set_iec958_status(chip, val);
790   - up(&chip->mixer_mutex);
  790 + mutex_unlock(&chip->mixer_mutex);
791 791 return 1;
792 792 }
793   - up(&chip->mixer_mutex);
  793 + mutex_unlock(&chip->mixer_mutex);
794 794 return 0;
795 795 }
796 796  
... ... @@ -88,7 +88,7 @@
88 88 bus = kzalloc(sizeof(*bus), GFP_KERNEL);
89 89 if (bus == NULL)
90 90 return -ENOMEM;
91   - init_MUTEX(&bus->lock_mutex);
  91 + mutex_init(&bus->lock_mutex);
92 92 INIT_LIST_HEAD(&bus->devices);
93 93 INIT_LIST_HEAD(&bus->buses);
94 94 bus->card = card;
sound/synth/emux/emux.c
... ... @@ -45,7 +45,7 @@
45 45 return -ENOMEM;
46 46  
47 47 spin_lock_init(&emu->voice_lock);
48   - init_MUTEX(&emu->register_mutex);
  48 + mutex_init(&emu->register_mutex);
49 49  
50 50 emu->client = -1;
51 51 #ifdef CONFIG_SND_SEQUENCER_OSS
sound/synth/emux/emux_oss.c
... ... @@ -117,10 +117,10 @@
117 117 emu = closure;
118 118 snd_assert(arg != NULL && emu != NULL, return -ENXIO);
119 119  
120   - down(&emu->register_mutex);
  120 + mutex_lock(&emu->register_mutex);
121 121  
122 122 if (!snd_emux_inc_count(emu)) {
123   - up(&emu->register_mutex);
  123 + mutex_unlock(&emu->register_mutex);
124 124 return -EFAULT;
125 125 }
126 126  
... ... @@ -134,7 +134,7 @@
134 134 if (p == NULL) {
135 135 snd_printk("can't create port\n");
136 136 snd_emux_dec_count(emu);
137   - up(&emu->register_mutex);
  137 + mutex_unlock(&emu->register_mutex);
138 138 return -ENOMEM;
139 139 }
140 140  
... ... @@ -148,7 +148,7 @@
148 148  
149 149 snd_emux_reset_port(p);
150 150  
151   - up(&emu->register_mutex);
  151 + mutex_unlock(&emu->register_mutex);
152 152 return 0;
153 153 }
154 154  
155 155  
... ... @@ -191,13 +191,13 @@
191 191 emu = p->emu;
192 192 snd_assert(emu != NULL, return -ENXIO);
193 193  
194   - down(&emu->register_mutex);
  194 + mutex_lock(&emu->register_mutex);
195 195 snd_emux_sounds_off_all(p);
196 196 snd_soundfont_close_check(emu->sflist, SF_CLIENT_NO(p->chset.port));
197 197 snd_seq_event_port_detach(p->chset.client, p->chset.port);
198 198 snd_emux_dec_count(emu);
199 199  
200   - up(&emu->register_mutex);
  200 + mutex_unlock(&emu->register_mutex);
201 201 return 0;
202 202 }
203 203  
sound/synth/emux/emux_proc.c
... ... @@ -37,7 +37,7 @@
37 37 int i;
38 38  
39 39 emu = entry->private_data;
40   - down(&emu->register_mutex);
  40 + mutex_lock(&emu->register_mutex);
41 41 if (emu->name)
42 42 snd_iprintf(buf, "Device: %s\n", emu->name);
43 43 snd_iprintf(buf, "Ports: %d\n", emu->num_ports);
44 44  
... ... @@ -56,13 +56,13 @@
56 56 snd_iprintf(buf, "Memory Size: 0\n");
57 57 }
58 58 if (emu->sflist) {
59   - down(&emu->sflist->presets_mutex);
  59 + mutex_lock(&emu->sflist->presets_mutex);
60 60 snd_iprintf(buf, "SoundFonts: %d\n", emu->sflist->fonts_size);
61 61 snd_iprintf(buf, "Instruments: %d\n", emu->sflist->zone_counter);
62 62 snd_iprintf(buf, "Samples: %d\n", emu->sflist->sample_counter);
63 63 snd_iprintf(buf, "Locked Instruments: %d\n", emu->sflist->zone_locked);
64 64 snd_iprintf(buf, "Locked Samples: %d\n", emu->sflist->sample_locked);
65   - up(&emu->sflist->presets_mutex);
  65 + mutex_unlock(&emu->sflist->presets_mutex);
66 66 }
67 67 #if 0 /* debug */
68 68 if (emu->voices[0].state != SNDRV_EMUX_ST_OFF && emu->voices[0].ch >= 0) {
... ... @@ -103,7 +103,7 @@
103 103 snd_iprintf(buf, "sample_mode=%x, rate=%x\n", vp->reg.sample_mode, vp->reg.rate_offset);
104 104 }
105 105 #endif
106   - up(&emu->register_mutex);
  106 + mutex_unlock(&emu->register_mutex);
107 107 }
108 108  
109 109  
sound/synth/emux/emux_seq.c
... ... @@ -123,12 +123,12 @@
123 123 if (emu->voices)
124 124 snd_emux_terminate_all(emu);
125 125  
126   - down(&emu->register_mutex);
  126 + mutex_lock(&emu->register_mutex);
127 127 if (emu->client >= 0) {
128 128 snd_seq_delete_kernel_client(emu->client);
129 129 emu->client = -1;
130 130 }
131   - up(&emu->register_mutex);
  131 + mutex_unlock(&emu->register_mutex);
132 132 }
133 133  
134 134  
135 135  
... ... @@ -311,10 +311,10 @@
311 311 emu = p->emu;
312 312 snd_assert(emu != NULL, return -EINVAL);
313 313  
314   - down(&emu->register_mutex);
  314 + mutex_lock(&emu->register_mutex);
315 315 snd_emux_init_port(p);
316 316 snd_emux_inc_count(emu);
317   - up(&emu->register_mutex);
  317 + mutex_unlock(&emu->register_mutex);
318 318 return 0;
319 319 }
320 320  
321 321  
... ... @@ -332,10 +332,10 @@
332 332 emu = p->emu;
333 333 snd_assert(emu != NULL, return -EINVAL);
334 334  
335   - down(&emu->register_mutex);
  335 + mutex_lock(&emu->register_mutex);
336 336 snd_emux_sounds_off_all(p);
337 337 snd_emux_dec_count(emu);
338   - up(&emu->register_mutex);
  338 + mutex_unlock(&emu->register_mutex);
339 339 return 0;
340 340 }
341 341  
sound/synth/emux/soundfont.c
... ... @@ -79,7 +79,7 @@
79 79 lock_preset(struct snd_sf_list *sflist)
80 80 {
81 81 unsigned long flags;
82   - down(&sflist->presets_mutex);
  82 + mutex_lock(&sflist->presets_mutex);
83 83 spin_lock_irqsave(&sflist->lock, flags);
84 84 sflist->presets_locked = 1;
85 85 spin_unlock_irqrestore(&sflist->lock, flags);
... ... @@ -96,7 +96,7 @@
96 96 spin_lock_irqsave(&sflist->lock, flags);
97 97 sflist->presets_locked = 0;
98 98 spin_unlock_irqrestore(&sflist->lock, flags);
99   - up(&sflist->presets_mutex);
  99 + mutex_unlock(&sflist->presets_mutex);
100 100 }
101 101  
102 102  
... ... @@ -1390,7 +1390,7 @@
1390 1390 if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL)
1391 1391 return NULL;
1392 1392  
1393   - init_MUTEX(&sflist->presets_mutex);
  1393 + mutex_init(&sflist->presets_mutex);
1394 1394 spin_lock_init(&sflist->lock);
1395 1395 sflist->memhdr = hdr;
1396 1396  
sound/synth/util_mem.c
... ... @@ -18,6 +18,7 @@
18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 19 */
20 20  
  21 +#include <linux/mutex.h>
21 22 #include <sound/driver.h>
22 23 #include <linux/init.h>
23 24 #include <linux/slab.h>
... ... @@ -42,7 +43,7 @@
42 43 if (hdr == NULL)
43 44 return NULL;
44 45 hdr->size = memsize;
45   - init_MUTEX(&hdr->block_mutex);
  46 + mutex_init(&hdr->block_mutex);
46 47 INIT_LIST_HEAD(&hdr->block);
47 48  
48 49 return hdr;
49 50  
... ... @@ -136,9 +137,9 @@
136 137 snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size)
137 138 {
138 139 struct snd_util_memblk *blk;
139   - down(&hdr->block_mutex);
  140 + mutex_lock(&hdr->block_mutex);
140 141 blk = __snd_util_mem_alloc(hdr, size);
141   - up(&hdr->block_mutex);
  142 + mutex_unlock(&hdr->block_mutex);
142 143 return blk;
143 144 }
144 145  
145 146  
... ... @@ -163,9 +164,9 @@
163 164 {
164 165 snd_assert(hdr && blk, return -EINVAL);
165 166  
166   - down(&hdr->block_mutex);
  167 + mutex_lock(&hdr->block_mutex);
167 168 __snd_util_mem_free(hdr, blk);
168   - up(&hdr->block_mutex);
  169 + mutex_unlock(&hdr->block_mutex);
169 170 return 0;
170 171 }
171 172  
172 173  
... ... @@ -175,9 +176,9 @@
175 176 int snd_util_mem_avail(struct snd_util_memhdr *hdr)
176 177 {
177 178 unsigned int size;
178   - down(&hdr->block_mutex);
  179 + mutex_lock(&hdr->block_mutex);
179 180 size = hdr->size - hdr->used;
180   - up(&hdr->block_mutex);
  181 + mutex_unlock(&hdr->block_mutex);
181 182 return size;
182 183 }
183 184