aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/memalloc.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-16 10:29:08 -0500
committerJaroslav Kysela <perex@suse.cz>2006-03-22 04:24:50 -0500
commit1a60d4c5a0c4028559585a74e48593b16e1ca9b2 (patch)
treef03f8dfcd554f8ebbb295522dc46dfe4d110a484 /sound/core/memalloc.c
parentf0283f45a04d5cf31512e5e390a38504d97e7a97 (diff)
[ALSA] semaphore -> mutex (core 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/core/memalloc.c')
-rw-r--r--sound/core/memalloc.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index 19b3dcbb09c2..9f2b88cb5877 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -31,7 +31,7 @@
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
33#include <linux/moduleparam.h> 33#include <linux/moduleparam.h>
34#include <asm/semaphore.h> 34#include <linux/mutex.h>
35#include <sound/memalloc.h> 35#include <sound/memalloc.h>
36#ifdef CONFIG_SBUS 36#ifdef CONFIG_SBUS
37#include <asm/sbus.h> 37#include <asm/sbus.h>
@@ -54,7 +54,7 @@ int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab);
54/* 54/*
55 */ 55 */
56 56
57static DECLARE_MUTEX(list_mutex); 57static DEFINE_MUTEX(list_mutex);
58static LIST_HEAD(mem_list_head); 58static LIST_HEAD(mem_list_head);
59 59
60/* buffer preservation list */ 60/* buffer preservation list */
@@ -440,7 +440,7 @@ size_t snd_dma_get_reserved_buf(struct snd_dma_buffer *dmab, unsigned int id)
440 440
441 snd_assert(dmab, return 0); 441 snd_assert(dmab, return 0);
442 442
443 down(&list_mutex); 443 mutex_lock(&list_mutex);
444 list_for_each(p, &mem_list_head) { 444 list_for_each(p, &mem_list_head) {
445 mem = list_entry(p, struct snd_mem_list, list); 445 mem = list_entry(p, struct snd_mem_list, list);
446 if (mem->id == id && 446 if (mem->id == id &&
@@ -452,11 +452,11 @@ size_t snd_dma_get_reserved_buf(struct snd_dma_buffer *dmab, unsigned int id)
452 if (dmab->dev.dev == NULL) 452 if (dmab->dev.dev == NULL)
453 dmab->dev.dev = dev; 453 dmab->dev.dev = dev;
454 kfree(mem); 454 kfree(mem);
455 up(&list_mutex); 455 mutex_unlock(&list_mutex);
456 return dmab->bytes; 456 return dmab->bytes;
457 } 457 }
458 } 458 }
459 up(&list_mutex); 459 mutex_unlock(&list_mutex);
460 return 0; 460 return 0;
461} 461}
462 462
@@ -477,11 +477,11 @@ int snd_dma_reserve_buf(struct snd_dma_buffer *dmab, unsigned int id)
477 mem = kmalloc(sizeof(*mem), GFP_KERNEL); 477 mem = kmalloc(sizeof(*mem), GFP_KERNEL);
478 if (! mem) 478 if (! mem)
479 return -ENOMEM; 479 return -ENOMEM;
480 down(&list_mutex); 480 mutex_lock(&list_mutex);
481 mem->buffer = *dmab; 481 mem->buffer = *dmab;
482 mem->id = id; 482 mem->id = id;
483 list_add_tail(&mem->list, &mem_list_head); 483 list_add_tail(&mem->list, &mem_list_head);
484 up(&list_mutex); 484 mutex_unlock(&list_mutex);
485 return 0; 485 return 0;
486} 486}
487 487
@@ -493,7 +493,7 @@ static void free_all_reserved_pages(void)
493 struct list_head *p; 493 struct list_head *p;
494 struct snd_mem_list *mem; 494 struct snd_mem_list *mem;
495 495
496 down(&list_mutex); 496 mutex_lock(&list_mutex);
497 while (! list_empty(&mem_list_head)) { 497 while (! list_empty(&mem_list_head)) {
498 p = mem_list_head.next; 498 p = mem_list_head.next;
499 mem = list_entry(p, struct snd_mem_list, list); 499 mem = list_entry(p, struct snd_mem_list, list);
@@ -501,7 +501,7 @@ static void free_all_reserved_pages(void)
501 snd_dma_free_pages(&mem->buffer); 501 snd_dma_free_pages(&mem->buffer);
502 kfree(mem); 502 kfree(mem);
503 } 503 }
504 up(&list_mutex); 504 mutex_unlock(&list_mutex);
505} 505}
506 506
507 507
@@ -522,7 +522,7 @@ static int snd_mem_proc_read(char *page, char **start, off_t off,
522 int devno; 522 int devno;
523 static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG", "SBUS" }; 523 static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG", "SBUS" };
524 524
525 down(&list_mutex); 525 mutex_lock(&list_mutex);
526 len += snprintf(page + len, count - len, 526 len += snprintf(page + len, count - len,
527 "pages : %li bytes (%li pages per %likB)\n", 527 "pages : %li bytes (%li pages per %likB)\n",
528 pages * PAGE_SIZE, pages, PAGE_SIZE / 1024); 528 pages * PAGE_SIZE, pages, PAGE_SIZE / 1024);
@@ -537,7 +537,7 @@ static int snd_mem_proc_read(char *page, char **start, off_t off,
537 " addr = 0x%lx, size = %d bytes\n", 537 " addr = 0x%lx, size = %d bytes\n",
538 (unsigned long)mem->buffer.addr, (int)mem->buffer.bytes); 538 (unsigned long)mem->buffer.addr, (int)mem->buffer.bytes);
539 } 539 }
540 up(&list_mutex); 540 mutex_unlock(&list_mutex);
541 return len; 541 return len;
542} 542}
543 543