diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-01-16 10:31:42 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 04:24:57 -0500 |
commit | ef9f0a42db987e7e2df72289fb4522d24027786b (patch) | |
tree | 34f3ad0c1abdbeb6df5a1d5137db6b4f34695f5a /sound/synth | |
parent | 1a60d4c5a0c4028559585a74e48593b16e1ca9b2 (diff) |
[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>
Diffstat (limited to 'sound/synth')
-rw-r--r-- | sound/synth/emux/emux.c | 2 | ||||
-rw-r--r-- | sound/synth/emux/emux_oss.c | 12 | ||||
-rw-r--r-- | sound/synth/emux/emux_proc.c | 8 | ||||
-rw-r--r-- | sound/synth/emux/emux_seq.c | 12 | ||||
-rw-r--r-- | sound/synth/emux/soundfont.c | 6 | ||||
-rw-r--r-- | sound/synth/util_mem.c | 15 |
6 files changed, 28 insertions, 27 deletions
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c index 7c8e328fae62..fc733bbf4487 100644 --- a/sound/synth/emux/emux.c +++ b/sound/synth/emux/emux.c | |||
@@ -45,7 +45,7 @@ int snd_emux_new(struct snd_emux **remu) | |||
45 | return -ENOMEM; | 45 | return -ENOMEM; |
46 | 46 | ||
47 | spin_lock_init(&emu->voice_lock); | 47 | spin_lock_init(&emu->voice_lock); |
48 | init_MUTEX(&emu->register_mutex); | 48 | mutex_init(&emu->register_mutex); |
49 | 49 | ||
50 | emu->client = -1; | 50 | emu->client = -1; |
51 | #ifdef CONFIG_SND_SEQUENCER_OSS | 51 | #ifdef CONFIG_SND_SEQUENCER_OSS |
diff --git a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c index dfbfcfbe5dd2..3436816727c8 100644 --- a/sound/synth/emux/emux_oss.c +++ b/sound/synth/emux/emux_oss.c | |||
@@ -117,10 +117,10 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure) | |||
117 | emu = closure; | 117 | emu = closure; |
118 | snd_assert(arg != NULL && emu != NULL, return -ENXIO); | 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 | if (!snd_emux_inc_count(emu)) { | 122 | if (!snd_emux_inc_count(emu)) { |
123 | up(&emu->register_mutex); | 123 | mutex_unlock(&emu->register_mutex); |
124 | return -EFAULT; | 124 | return -EFAULT; |
125 | } | 125 | } |
126 | 126 | ||
@@ -134,7 +134,7 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure) | |||
134 | if (p == NULL) { | 134 | if (p == NULL) { |
135 | snd_printk("can't create port\n"); | 135 | snd_printk("can't create port\n"); |
136 | snd_emux_dec_count(emu); | 136 | snd_emux_dec_count(emu); |
137 | up(&emu->register_mutex); | 137 | mutex_unlock(&emu->register_mutex); |
138 | return -ENOMEM; | 138 | return -ENOMEM; |
139 | } | 139 | } |
140 | 140 | ||
@@ -148,7 +148,7 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure) | |||
148 | 148 | ||
149 | snd_emux_reset_port(p); | 149 | snd_emux_reset_port(p); |
150 | 150 | ||
151 | up(&emu->register_mutex); | 151 | mutex_unlock(&emu->register_mutex); |
152 | return 0; | 152 | return 0; |
153 | } | 153 | } |
154 | 154 | ||
@@ -191,13 +191,13 @@ snd_emux_close_seq_oss(struct snd_seq_oss_arg *arg) | |||
191 | emu = p->emu; | 191 | emu = p->emu; |
192 | snd_assert(emu != NULL, return -ENXIO); | 192 | snd_assert(emu != NULL, return -ENXIO); |
193 | 193 | ||
194 | down(&emu->register_mutex); | 194 | mutex_lock(&emu->register_mutex); |
195 | snd_emux_sounds_off_all(p); | 195 | snd_emux_sounds_off_all(p); |
196 | snd_soundfont_close_check(emu->sflist, SF_CLIENT_NO(p->chset.port)); | 196 | snd_soundfont_close_check(emu->sflist, SF_CLIENT_NO(p->chset.port)); |
197 | snd_seq_event_port_detach(p->chset.client, p->chset.port); | 197 | snd_seq_event_port_detach(p->chset.client, p->chset.port); |
198 | snd_emux_dec_count(emu); | 198 | snd_emux_dec_count(emu); |
199 | 199 | ||
200 | up(&emu->register_mutex); | 200 | mutex_unlock(&emu->register_mutex); |
201 | return 0; | 201 | return 0; |
202 | } | 202 | } |
203 | 203 | ||
diff --git a/sound/synth/emux/emux_proc.c b/sound/synth/emux/emux_proc.c index a70a179f6947..1ba68ce30279 100644 --- a/sound/synth/emux/emux_proc.c +++ b/sound/synth/emux/emux_proc.c | |||
@@ -37,7 +37,7 @@ snd_emux_proc_info_read(struct snd_info_entry *entry, | |||
37 | int i; | 37 | int i; |
38 | 38 | ||
39 | emu = entry->private_data; | 39 | emu = entry->private_data; |
40 | down(&emu->register_mutex); | 40 | mutex_lock(&emu->register_mutex); |
41 | if (emu->name) | 41 | if (emu->name) |
42 | snd_iprintf(buf, "Device: %s\n", emu->name); | 42 | snd_iprintf(buf, "Device: %s\n", emu->name); |
43 | snd_iprintf(buf, "Ports: %d\n", emu->num_ports); | 43 | snd_iprintf(buf, "Ports: %d\n", emu->num_ports); |
@@ -56,13 +56,13 @@ snd_emux_proc_info_read(struct snd_info_entry *entry, | |||
56 | snd_iprintf(buf, "Memory Size: 0\n"); | 56 | snd_iprintf(buf, "Memory Size: 0\n"); |
57 | } | 57 | } |
58 | if (emu->sflist) { | 58 | if (emu->sflist) { |
59 | down(&emu->sflist->presets_mutex); | 59 | mutex_lock(&emu->sflist->presets_mutex); |
60 | snd_iprintf(buf, "SoundFonts: %d\n", emu->sflist->fonts_size); | 60 | snd_iprintf(buf, "SoundFonts: %d\n", emu->sflist->fonts_size); |
61 | snd_iprintf(buf, "Instruments: %d\n", emu->sflist->zone_counter); | 61 | snd_iprintf(buf, "Instruments: %d\n", emu->sflist->zone_counter); |
62 | snd_iprintf(buf, "Samples: %d\n", emu->sflist->sample_counter); | 62 | snd_iprintf(buf, "Samples: %d\n", emu->sflist->sample_counter); |
63 | snd_iprintf(buf, "Locked Instruments: %d\n", emu->sflist->zone_locked); | 63 | snd_iprintf(buf, "Locked Instruments: %d\n", emu->sflist->zone_locked); |
64 | snd_iprintf(buf, "Locked Samples: %d\n", emu->sflist->sample_locked); | 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 | #if 0 /* debug */ | 67 | #if 0 /* debug */ |
68 | if (emu->voices[0].state != SNDRV_EMUX_ST_OFF && emu->voices[0].ch >= 0) { | 68 | if (emu->voices[0].state != SNDRV_EMUX_ST_OFF && emu->voices[0].ch >= 0) { |
@@ -103,7 +103,7 @@ snd_emux_proc_info_read(struct snd_info_entry *entry, | |||
103 | snd_iprintf(buf, "sample_mode=%x, rate=%x\n", vp->reg.sample_mode, vp->reg.rate_offset); | 103 | snd_iprintf(buf, "sample_mode=%x, rate=%x\n", vp->reg.sample_mode, vp->reg.rate_offset); |
104 | } | 104 | } |
105 | #endif | 105 | #endif |
106 | up(&emu->register_mutex); | 106 | mutex_unlock(&emu->register_mutex); |
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c index 1a973d7a90f8..8f00f07701c4 100644 --- a/sound/synth/emux/emux_seq.c +++ b/sound/synth/emux/emux_seq.c | |||
@@ -123,12 +123,12 @@ snd_emux_detach_seq(struct snd_emux *emu) | |||
123 | if (emu->voices) | 123 | if (emu->voices) |
124 | snd_emux_terminate_all(emu); | 124 | snd_emux_terminate_all(emu); |
125 | 125 | ||
126 | down(&emu->register_mutex); | 126 | mutex_lock(&emu->register_mutex); |
127 | if (emu->client >= 0) { | 127 | if (emu->client >= 0) { |
128 | snd_seq_delete_kernel_client(emu->client); | 128 | snd_seq_delete_kernel_client(emu->client); |
129 | emu->client = -1; | 129 | emu->client = -1; |
130 | } | 130 | } |
131 | up(&emu->register_mutex); | 131 | mutex_unlock(&emu->register_mutex); |
132 | } | 132 | } |
133 | 133 | ||
134 | 134 | ||
@@ -311,10 +311,10 @@ snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info) | |||
311 | emu = p->emu; | 311 | emu = p->emu; |
312 | snd_assert(emu != NULL, return -EINVAL); | 312 | snd_assert(emu != NULL, return -EINVAL); |
313 | 313 | ||
314 | down(&emu->register_mutex); | 314 | mutex_lock(&emu->register_mutex); |
315 | snd_emux_init_port(p); | 315 | snd_emux_init_port(p); |
316 | snd_emux_inc_count(emu); | 316 | snd_emux_inc_count(emu); |
317 | up(&emu->register_mutex); | 317 | mutex_unlock(&emu->register_mutex); |
318 | return 0; | 318 | return 0; |
319 | } | 319 | } |
320 | 320 | ||
@@ -332,10 +332,10 @@ snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info) | |||
332 | emu = p->emu; | 332 | emu = p->emu; |
333 | snd_assert(emu != NULL, return -EINVAL); | 333 | snd_assert(emu != NULL, return -EINVAL); |
334 | 334 | ||
335 | down(&emu->register_mutex); | 335 | mutex_lock(&emu->register_mutex); |
336 | snd_emux_sounds_off_all(p); | 336 | snd_emux_sounds_off_all(p); |
337 | snd_emux_dec_count(emu); | 337 | snd_emux_dec_count(emu); |
338 | up(&emu->register_mutex); | 338 | mutex_unlock(&emu->register_mutex); |
339 | return 0; | 339 | return 0; |
340 | } | 340 | } |
341 | 341 | ||
diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c index 4c5754d4a2e8..32c27162dfb6 100644 --- a/sound/synth/emux/soundfont.c +++ b/sound/synth/emux/soundfont.c | |||
@@ -79,7 +79,7 @@ static void | |||
79 | lock_preset(struct snd_sf_list *sflist) | 79 | lock_preset(struct snd_sf_list *sflist) |
80 | { | 80 | { |
81 | unsigned long flags; | 81 | unsigned long flags; |
82 | down(&sflist->presets_mutex); | 82 | mutex_lock(&sflist->presets_mutex); |
83 | spin_lock_irqsave(&sflist->lock, flags); | 83 | spin_lock_irqsave(&sflist->lock, flags); |
84 | sflist->presets_locked = 1; | 84 | sflist->presets_locked = 1; |
85 | spin_unlock_irqrestore(&sflist->lock, flags); | 85 | spin_unlock_irqrestore(&sflist->lock, flags); |
@@ -96,7 +96,7 @@ unlock_preset(struct snd_sf_list *sflist) | |||
96 | spin_lock_irqsave(&sflist->lock, flags); | 96 | spin_lock_irqsave(&sflist->lock, flags); |
97 | sflist->presets_locked = 0; | 97 | sflist->presets_locked = 0; |
98 | spin_unlock_irqrestore(&sflist->lock, flags); | 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 @@ snd_sf_new(struct snd_sf_callback *callback, struct snd_util_memhdr *hdr) | |||
1390 | if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL) | 1390 | if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL) |
1391 | return NULL; | 1391 | return NULL; |
1392 | 1392 | ||
1393 | init_MUTEX(&sflist->presets_mutex); | 1393 | mutex_init(&sflist->presets_mutex); |
1394 | spin_lock_init(&sflist->lock); | 1394 | spin_lock_init(&sflist->lock); |
1395 | sflist->memhdr = hdr; | 1395 | sflist->memhdr = hdr; |
1396 | 1396 | ||
diff --git a/sound/synth/util_mem.c b/sound/synth/util_mem.c index 217e8e552a42..1d9b11f345f8 100644 --- a/sound/synth/util_mem.c +++ b/sound/synth/util_mem.c | |||
@@ -18,6 +18,7 @@ | |||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/mutex.h> | ||
21 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
22 | #include <linux/init.h> | 23 | #include <linux/init.h> |
23 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
@@ -42,7 +43,7 @@ snd_util_memhdr_new(int memsize) | |||
42 | if (hdr == NULL) | 43 | if (hdr == NULL) |
43 | return NULL; | 44 | return NULL; |
44 | hdr->size = memsize; | 45 | hdr->size = memsize; |
45 | init_MUTEX(&hdr->block_mutex); | 46 | mutex_init(&hdr->block_mutex); |
46 | INIT_LIST_HEAD(&hdr->block); | 47 | INIT_LIST_HEAD(&hdr->block); |
47 | 48 | ||
48 | return hdr; | 49 | return hdr; |
@@ -136,9 +137,9 @@ struct snd_util_memblk * | |||
136 | snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size) | 137 | snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size) |
137 | { | 138 | { |
138 | struct snd_util_memblk *blk; | 139 | struct snd_util_memblk *blk; |
139 | down(&hdr->block_mutex); | 140 | mutex_lock(&hdr->block_mutex); |
140 | blk = __snd_util_mem_alloc(hdr, size); | 141 | blk = __snd_util_mem_alloc(hdr, size); |
141 | up(&hdr->block_mutex); | 142 | mutex_unlock(&hdr->block_mutex); |
142 | return blk; | 143 | return blk; |
143 | } | 144 | } |
144 | 145 | ||
@@ -163,9 +164,9 @@ int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk) | |||
163 | { | 164 | { |
164 | snd_assert(hdr && blk, return -EINVAL); | 165 | snd_assert(hdr && blk, return -EINVAL); |
165 | 166 | ||
166 | down(&hdr->block_mutex); | 167 | mutex_lock(&hdr->block_mutex); |
167 | __snd_util_mem_free(hdr, blk); | 168 | __snd_util_mem_free(hdr, blk); |
168 | up(&hdr->block_mutex); | 169 | mutex_unlock(&hdr->block_mutex); |
169 | return 0; | 170 | return 0; |
170 | } | 171 | } |
171 | 172 | ||
@@ -175,9 +176,9 @@ int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk) | |||
175 | int snd_util_mem_avail(struct snd_util_memhdr *hdr) | 176 | int snd_util_mem_avail(struct snd_util_memhdr *hdr) |
176 | { | 177 | { |
177 | unsigned int size; | 178 | unsigned int size; |
178 | down(&hdr->block_mutex); | 179 | mutex_lock(&hdr->block_mutex); |
179 | size = hdr->size - hdr->used; | 180 | size = hdr->size - hdr->used; |
180 | up(&hdr->block_mutex); | 181 | mutex_unlock(&hdr->block_mutex); |
181 | return size; | 182 | return size; |
182 | } | 183 | } |
183 | 184 | ||