aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1/memory.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-16 10:34:20 -0500
committerJaroslav Kysela <perex@suse.cz>2006-03-22 04:25:29 -0500
commit62932df8fb20ba2fb53a95fa52445eba22e821fe (patch)
tree335178d7438395a68a453a9c23624b3e9fc5ec40 /sound/pci/emu10k1/memory.c
parent8b7547f95cbe8a5940df62ed730646fdfcba5fda (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/emu10k1/memory.c')
-rw-r--r--sound/pci/emu10k1/memory.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c
index 68c795c03109..e7ec98649f04 100644
--- a/sound/pci/emu10k1/memory.c
+++ b/sound/pci/emu10k1/memory.c
@@ -24,6 +24,8 @@
24#include <sound/driver.h> 24#include <sound/driver.h>
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/time.h> 26#include <linux/time.h>
27#include <linux/mutex.h>
28
27#include <sound/core.h> 29#include <sound/core.h>
28#include <sound/emu10k1.h> 30#include <sound/emu10k1.h>
29 31
@@ -302,10 +304,10 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
302 hdr = emu->memhdr; 304 hdr = emu->memhdr;
303 snd_assert(hdr, return NULL); 305 snd_assert(hdr, return NULL);
304 306
305 down(&hdr->block_mutex); 307 mutex_lock(&hdr->block_mutex);
306 blk = search_empty(emu, runtime->dma_bytes); 308 blk = search_empty(emu, runtime->dma_bytes);
307 if (blk == NULL) { 309 if (blk == NULL) {
308 up(&hdr->block_mutex); 310 mutex_unlock(&hdr->block_mutex);
309 return NULL; 311 return NULL;
310 } 312 }
311 /* fill buffer addresses but pointers are not stored so that 313 /* fill buffer addresses but pointers are not stored so that
@@ -318,14 +320,14 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
318 if (idx >= sgbuf->pages) { 320 if (idx >= sgbuf->pages) {
319 printk(KERN_ERR "emu: pages overflow! (%d-%d) for %d\n", 321 printk(KERN_ERR "emu: pages overflow! (%d-%d) for %d\n",
320 blk->first_page, blk->last_page, sgbuf->pages); 322 blk->first_page, blk->last_page, sgbuf->pages);
321 up(&hdr->block_mutex); 323 mutex_unlock(&hdr->block_mutex);
322 return NULL; 324 return NULL;
323 } 325 }
324#endif 326#endif
325 addr = sgbuf->table[idx].addr; 327 addr = sgbuf->table[idx].addr;
326 if (! is_valid_page(emu, addr)) { 328 if (! is_valid_page(emu, addr)) {
327 printk(KERN_ERR "emu: failure page = %d\n", idx); 329 printk(KERN_ERR "emu: failure page = %d\n", idx);
328 up(&hdr->block_mutex); 330 mutex_unlock(&hdr->block_mutex);
329 return NULL; 331 return NULL;
330 } 332 }
331 emu->page_addr_table[page] = addr; 333 emu->page_addr_table[page] = addr;
@@ -337,10 +339,10 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
337 err = snd_emu10k1_memblk_map(emu, blk); 339 err = snd_emu10k1_memblk_map(emu, blk);
338 if (err < 0) { 340 if (err < 0) {
339 __snd_util_mem_free(hdr, (struct snd_util_memblk *)blk); 341 __snd_util_mem_free(hdr, (struct snd_util_memblk *)blk);
340 up(&hdr->block_mutex); 342 mutex_unlock(&hdr->block_mutex);
341 return NULL; 343 return NULL;
342 } 344 }
343 up(&hdr->block_mutex); 345 mutex_unlock(&hdr->block_mutex);
344 return (struct snd_util_memblk *)blk; 346 return (struct snd_util_memblk *)blk;
345} 347}
346 348
@@ -369,19 +371,19 @@ snd_emu10k1_synth_alloc(struct snd_emu10k1 *hw, unsigned int size)
369 struct snd_emu10k1_memblk *blk; 371 struct snd_emu10k1_memblk *blk;
370 struct snd_util_memhdr *hdr = hw->memhdr; 372 struct snd_util_memhdr *hdr = hw->memhdr;
371 373
372 down(&hdr->block_mutex); 374 mutex_lock(&hdr->block_mutex);
373 blk = (struct snd_emu10k1_memblk *)__snd_util_mem_alloc(hdr, size); 375 blk = (struct snd_emu10k1_memblk *)__snd_util_mem_alloc(hdr, size);
374 if (blk == NULL) { 376 if (blk == NULL) {
375 up(&hdr->block_mutex); 377 mutex_unlock(&hdr->block_mutex);
376 return NULL; 378 return NULL;
377 } 379 }
378 if (synth_alloc_pages(hw, blk)) { 380 if (synth_alloc_pages(hw, blk)) {
379 __snd_util_mem_free(hdr, (struct snd_util_memblk *)blk); 381 __snd_util_mem_free(hdr, (struct snd_util_memblk *)blk);
380 up(&hdr->block_mutex); 382 mutex_unlock(&hdr->block_mutex);
381 return NULL; 383 return NULL;
382 } 384 }
383 snd_emu10k1_memblk_map(hw, blk); 385 snd_emu10k1_memblk_map(hw, blk);
384 up(&hdr->block_mutex); 386 mutex_unlock(&hdr->block_mutex);
385 return (struct snd_util_memblk *)blk; 387 return (struct snd_util_memblk *)blk;
386} 388}
387 389
@@ -396,14 +398,14 @@ snd_emu10k1_synth_free(struct snd_emu10k1 *emu, struct snd_util_memblk *memblk)
396 struct snd_emu10k1_memblk *blk = (struct snd_emu10k1_memblk *)memblk; 398 struct snd_emu10k1_memblk *blk = (struct snd_emu10k1_memblk *)memblk;
397 unsigned long flags; 399 unsigned long flags;
398 400
399 down(&hdr->block_mutex); 401 mutex_lock(&hdr->block_mutex);
400 spin_lock_irqsave(&emu->memblk_lock, flags); 402 spin_lock_irqsave(&emu->memblk_lock, flags);
401 if (blk->mapped_page >= 0) 403 if (blk->mapped_page >= 0)
402 unmap_memblk(emu, blk); 404 unmap_memblk(emu, blk);
403 spin_unlock_irqrestore(&emu->memblk_lock, flags); 405 spin_unlock_irqrestore(&emu->memblk_lock, flags);
404 synth_free_pages(emu, blk); 406 synth_free_pages(emu, blk);
405 __snd_util_mem_free(hdr, memblk); 407 __snd_util_mem_free(hdr, memblk);
406 up(&hdr->block_mutex); 408 mutex_unlock(&hdr->block_mutex);
407 return 0; 409 return 0;
408} 410}
409 411