aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/memalloc.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2006-10-05 10:02:22 -0400
committerJaroslav Kysela <perex@suse.cz>2007-02-09 03:00:10 -0500
commit9244b2c3079faac79b3b961116bd548c45087e2c (patch)
tree1a9e2ead054ed58efcad3fd43fb2aedeb6731baa /sound/core/memalloc.c
parentd595ee7e0162ae66faa8c4c7d8c2069b40d64fed (diff)
[ALSA] alsa core: convert to list_for_each_entry*
This patch converts most uses of list_for_each to list_for_each_entry all across alsa. In some place apparently an item can be on a list with different pointers so of course that isn't compatible with list_for_each, I therefore didn't touch those places. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/core/memalloc.c')
-rw-r--r--sound/core/memalloc.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index bc0bd0910a62..f057430db0d0 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -406,19 +406,17 @@ void snd_dma_free_pages(struct snd_dma_buffer *dmab)
406 */ 406 */
407size_t snd_dma_get_reserved_buf(struct snd_dma_buffer *dmab, unsigned int id) 407size_t snd_dma_get_reserved_buf(struct snd_dma_buffer *dmab, unsigned int id)
408{ 408{
409 struct list_head *p;
410 struct snd_mem_list *mem; 409 struct snd_mem_list *mem;
411 410
412 snd_assert(dmab, return 0); 411 snd_assert(dmab, return 0);
413 412
414 mutex_lock(&list_mutex); 413 mutex_lock(&list_mutex);
415 list_for_each(p, &mem_list_head) { 414 list_for_each_entry(mem, &mem_list_head, list) {
416 mem = list_entry(p, struct snd_mem_list, list);
417 if (mem->id == id && 415 if (mem->id == id &&
418 (mem->buffer.dev.dev == NULL || dmab->dev.dev == NULL || 416 (mem->buffer.dev.dev == NULL || dmab->dev.dev == NULL ||
419 ! memcmp(&mem->buffer.dev, &dmab->dev, sizeof(dmab->dev)))) { 417 ! memcmp(&mem->buffer.dev, &dmab->dev, sizeof(dmab->dev)))) {
420 struct device *dev = dmab->dev.dev; 418 struct device *dev = dmab->dev.dev;
421 list_del(p); 419 list_del(&mem->list);
422 *dmab = mem->buffer; 420 *dmab = mem->buffer;
423 if (dmab->dev.dev == NULL) 421 if (dmab->dev.dev == NULL)
424 dmab->dev.dev = dev; 422 dmab->dev.dev = dev;
@@ -488,7 +486,6 @@ static int snd_mem_proc_read(char *page, char **start, off_t off,
488{ 486{
489 int len = 0; 487 int len = 0;
490 long pages = snd_allocated_pages >> (PAGE_SHIFT-12); 488 long pages = snd_allocated_pages >> (PAGE_SHIFT-12);
491 struct list_head *p;
492 struct snd_mem_list *mem; 489 struct snd_mem_list *mem;
493 int devno; 490 int devno;
494 static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG", "SBUS" }; 491 static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG", "SBUS" };
@@ -498,8 +495,7 @@ static int snd_mem_proc_read(char *page, char **start, off_t off,
498 "pages : %li bytes (%li pages per %likB)\n", 495 "pages : %li bytes (%li pages per %likB)\n",
499 pages * PAGE_SIZE, pages, PAGE_SIZE / 1024); 496 pages * PAGE_SIZE, pages, PAGE_SIZE / 1024);
500 devno = 0; 497 devno = 0;
501 list_for_each(p, &mem_list_head) { 498 list_for_each_entry(mem, &mem_list_head, list) {
502 mem = list_entry(p, struct snd_mem_list, list);
503 devno++; 499 devno++;
504 len += snprintf(page + len, count - len, 500 len += snprintf(page + len, count - len,
505 "buffer %d : ID %08x : type %s\n", 501 "buffer %d : ID %08x : type %s\n",