diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-01-16 10:34:20 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 04:25:29 -0500 |
commit | 62932df8fb20ba2fb53a95fa52445eba22e821fe (patch) | |
tree | 335178d7438395a68a453a9c23624b3e9fc5ec40 /sound/pci/trident | |
parent | 8b7547f95cbe8a5940df62ed730646fdfcba5fda (diff) |
[ALSA] semaphore -> mutex (PCI 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/pci/trident')
-rw-r--r-- | sound/pci/trident/trident_memory.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/sound/pci/trident/trident_memory.c b/sound/pci/trident/trident_memory.c index cf09ea99755c..46c6982c9e88 100644 --- a/sound/pci/trident/trident_memory.c +++ b/sound/pci/trident/trident_memory.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <asm/io.h> | 27 | #include <asm/io.h> |
28 | #include <linux/pci.h> | 28 | #include <linux/pci.h> |
29 | #include <linux/time.h> | 29 | #include <linux/time.h> |
30 | #include <linux/mutex.h> | ||
31 | |||
30 | #include <sound/core.h> | 32 | #include <sound/core.h> |
31 | #include <sound/trident.h> | 33 | #include <sound/trident.h> |
32 | 34 | ||
@@ -201,16 +203,16 @@ snd_trident_alloc_sg_pages(struct snd_trident *trident, | |||
201 | 203 | ||
202 | 204 | ||
203 | 205 | ||
204 | down(&hdr->block_mutex); | 206 | mutex_lock(&hdr->block_mutex); |
205 | blk = search_empty(hdr, runtime->dma_bytes); | 207 | blk = search_empty(hdr, runtime->dma_bytes); |
206 | if (blk == NULL) { | 208 | if (blk == NULL) { |
207 | up(&hdr->block_mutex); | 209 | mutex_unlock(&hdr->block_mutex); |
208 | return NULL; | 210 | return NULL; |
209 | } | 211 | } |
210 | if (lastpg(blk) - firstpg(blk) >= sgbuf->pages) { | 212 | if (lastpg(blk) - firstpg(blk) >= sgbuf->pages) { |
211 | snd_printk(KERN_ERR "page calculation doesn't match: allocated pages = %d, trident = %d/%d\n", sgbuf->pages, firstpg(blk), lastpg(blk)); | 213 | snd_printk(KERN_ERR "page calculation doesn't match: allocated pages = %d, trident = %d/%d\n", sgbuf->pages, firstpg(blk), lastpg(blk)); |
212 | __snd_util_mem_free(hdr, blk); | 214 | __snd_util_mem_free(hdr, blk); |
213 | up(&hdr->block_mutex); | 215 | mutex_unlock(&hdr->block_mutex); |
214 | return NULL; | 216 | return NULL; |
215 | } | 217 | } |
216 | 218 | ||
@@ -221,12 +223,12 @@ snd_trident_alloc_sg_pages(struct snd_trident *trident, | |||
221 | unsigned long ptr = (unsigned long)sgbuf->table[idx].buf; | 223 | unsigned long ptr = (unsigned long)sgbuf->table[idx].buf; |
222 | if (! is_valid_page(addr)) { | 224 | if (! is_valid_page(addr)) { |
223 | __snd_util_mem_free(hdr, blk); | 225 | __snd_util_mem_free(hdr, blk); |
224 | up(&hdr->block_mutex); | 226 | mutex_unlock(&hdr->block_mutex); |
225 | return NULL; | 227 | return NULL; |
226 | } | 228 | } |
227 | set_tlb_bus(trident, page, ptr, addr); | 229 | set_tlb_bus(trident, page, ptr, addr); |
228 | } | 230 | } |
229 | up(&hdr->block_mutex); | 231 | mutex_unlock(&hdr->block_mutex); |
230 | return blk; | 232 | return blk; |
231 | } | 233 | } |
232 | 234 | ||
@@ -248,10 +250,10 @@ snd_trident_alloc_cont_pages(struct snd_trident *trident, | |||
248 | hdr = trident->tlb.memhdr; | 250 | hdr = trident->tlb.memhdr; |
249 | snd_assert(hdr != NULL, return NULL); | 251 | snd_assert(hdr != NULL, return NULL); |
250 | 252 | ||
251 | down(&hdr->block_mutex); | 253 | mutex_lock(&hdr->block_mutex); |
252 | blk = search_empty(hdr, runtime->dma_bytes); | 254 | blk = search_empty(hdr, runtime->dma_bytes); |
253 | if (blk == NULL) { | 255 | if (blk == NULL) { |
254 | up(&hdr->block_mutex); | 256 | mutex_unlock(&hdr->block_mutex); |
255 | return NULL; | 257 | return NULL; |
256 | } | 258 | } |
257 | 259 | ||
@@ -262,12 +264,12 @@ snd_trident_alloc_cont_pages(struct snd_trident *trident, | |||
262 | ptr += SNDRV_TRIDENT_PAGE_SIZE, addr += SNDRV_TRIDENT_PAGE_SIZE) { | 264 | ptr += SNDRV_TRIDENT_PAGE_SIZE, addr += SNDRV_TRIDENT_PAGE_SIZE) { |
263 | if (! is_valid_page(addr)) { | 265 | if (! is_valid_page(addr)) { |
264 | __snd_util_mem_free(hdr, blk); | 266 | __snd_util_mem_free(hdr, blk); |
265 | up(&hdr->block_mutex); | 267 | mutex_unlock(&hdr->block_mutex); |
266 | return NULL; | 268 | return NULL; |
267 | } | 269 | } |
268 | set_tlb_bus(trident, page, ptr, addr); | 270 | set_tlb_bus(trident, page, ptr, addr); |
269 | } | 271 | } |
270 | up(&hdr->block_mutex); | 272 | mutex_unlock(&hdr->block_mutex); |
271 | return blk; | 273 | return blk; |
272 | } | 274 | } |
273 | 275 | ||
@@ -300,13 +302,13 @@ int snd_trident_free_pages(struct snd_trident *trident, | |||
300 | snd_assert(blk != NULL, return -EINVAL); | 302 | snd_assert(blk != NULL, return -EINVAL); |
301 | 303 | ||
302 | hdr = trident->tlb.memhdr; | 304 | hdr = trident->tlb.memhdr; |
303 | down(&hdr->block_mutex); | 305 | mutex_lock(&hdr->block_mutex); |
304 | /* reset TLB entries */ | 306 | /* reset TLB entries */ |
305 | for (page = firstpg(blk); page <= lastpg(blk); page++) | 307 | for (page = firstpg(blk); page <= lastpg(blk); page++) |
306 | set_silent_tlb(trident, page); | 308 | set_silent_tlb(trident, page); |
307 | /* free memory block */ | 309 | /* free memory block */ |
308 | __snd_util_mem_free(hdr, blk); | 310 | __snd_util_mem_free(hdr, blk); |
309 | up(&hdr->block_mutex); | 311 | mutex_unlock(&hdr->block_mutex); |
310 | return 0; | 312 | return 0; |
311 | } | 313 | } |
312 | 314 | ||
@@ -332,18 +334,18 @@ snd_trident_synth_alloc(struct snd_trident *hw, unsigned int size) | |||
332 | struct snd_util_memblk *blk; | 334 | struct snd_util_memblk *blk; |
333 | struct snd_util_memhdr *hdr = hw->tlb.memhdr; | 335 | struct snd_util_memhdr *hdr = hw->tlb.memhdr; |
334 | 336 | ||
335 | down(&hdr->block_mutex); | 337 | mutex_lock(&hdr->block_mutex); |
336 | blk = __snd_util_mem_alloc(hdr, size); | 338 | blk = __snd_util_mem_alloc(hdr, size); |
337 | if (blk == NULL) { | 339 | if (blk == NULL) { |
338 | up(&hdr->block_mutex); | 340 | mutex_unlock(&hdr->block_mutex); |
339 | return NULL; | 341 | return NULL; |
340 | } | 342 | } |
341 | if (synth_alloc_pages(hw, blk)) { | 343 | if (synth_alloc_pages(hw, blk)) { |
342 | __snd_util_mem_free(hdr, blk); | 344 | __snd_util_mem_free(hdr, blk); |
343 | up(&hdr->block_mutex); | 345 | mutex_unlock(&hdr->block_mutex); |
344 | return NULL; | 346 | return NULL; |
345 | } | 347 | } |
346 | up(&hdr->block_mutex); | 348 | mutex_unlock(&hdr->block_mutex); |
347 | return blk; | 349 | return blk; |
348 | } | 350 | } |
349 | 351 | ||
@@ -356,10 +358,10 @@ snd_trident_synth_free(struct snd_trident *hw, struct snd_util_memblk *blk) | |||
356 | { | 358 | { |
357 | struct snd_util_memhdr *hdr = hw->tlb.memhdr; | 359 | struct snd_util_memhdr *hdr = hw->tlb.memhdr; |
358 | 360 | ||
359 | down(&hdr->block_mutex); | 361 | mutex_lock(&hdr->block_mutex); |
360 | synth_free_pages(hw, blk); | 362 | synth_free_pages(hw, blk); |
361 | __snd_util_mem_free(hdr, blk); | 363 | __snd_util_mem_free(hdr, blk); |
362 | up(&hdr->block_mutex); | 364 | mutex_unlock(&hdr->block_mutex); |
363 | return 0; | 365 | return 0; |
364 | } | 366 | } |
365 | 367 | ||