aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-01-08 10:12:25 -0500
committerTakashi Iwai <tiwai@suse.de>2014-01-09 01:32:10 -0500
commit47d98c026ef9a9888c36f3c4f26b81f548a0ca86 (patch)
tree11601d8b6644c5a2dd75469978151d51ef6fb7e9 /sound/pci
parentd7b135410e1b2f5ad64e56df09d133a23aa9fbcb (diff)
ALSA: Remove memory reservation code from memalloc helper
Nowadays we have CMA for obtaining the contiguous memory pages efficiently. Let's kill the old kludge for reserving the memory pages for large buffers. It was rarely useful (only for preserving pages among module reloading or a little help by an early boot scripting), used only by a couple of drivers, and yet it gives too much ugliness than its benefit. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/es1968.c28
-rw-r--r--sound/pci/rme9652/hdsp.c10
-rw-r--r--sound/pci/rme9652/rme9652.c10
3 files changed, 17 insertions, 31 deletions
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index b0e3d92c4656..772cc36f951d 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -1422,7 +1422,7 @@ static void snd_es1968_free_dmabuf(struct es1968 *chip)
1422 1422
1423 if (! chip->dma.area) 1423 if (! chip->dma.area)
1424 return; 1424 return;
1425 snd_dma_reserve_buf(&chip->dma, snd_dma_pci_buf_id(chip->pci)); 1425 snd_dma_free_pages(&chip->dma);
1426 while ((p = chip->buf_list.next) != &chip->buf_list) { 1426 while ((p = chip->buf_list.next) != &chip->buf_list) {
1427 struct esm_memory *chunk = list_entry(p, struct esm_memory, list); 1427 struct esm_memory *chunk = list_entry(p, struct esm_memory, list);
1428 list_del(p); 1428 list_del(p);
@@ -1438,20 +1438,18 @@ snd_es1968_init_dmabuf(struct es1968 *chip)
1438 1438
1439 chip->dma.dev.type = SNDRV_DMA_TYPE_DEV; 1439 chip->dma.dev.type = SNDRV_DMA_TYPE_DEV;
1440 chip->dma.dev.dev = snd_dma_pci_data(chip->pci); 1440 chip->dma.dev.dev = snd_dma_pci_data(chip->pci);
1441 if (! snd_dma_get_reserved_buf(&chip->dma, snd_dma_pci_buf_id(chip->pci))) { 1441 err = snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV,
1442 err = snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, 1442 snd_dma_pci_data(chip->pci),
1443 snd_dma_pci_data(chip->pci), 1443 chip->total_bufsize, &chip->dma);
1444 chip->total_bufsize, &chip->dma); 1444 if (err < 0 || ! chip->dma.area) {
1445 if (err < 0 || ! chip->dma.area) { 1445 snd_printk(KERN_ERR "es1968: can't allocate dma pages for size %d\n",
1446 snd_printk(KERN_ERR "es1968: can't allocate dma pages for size %d\n", 1446 chip->total_bufsize);
1447 chip->total_bufsize); 1447 return -ENOMEM;
1448 return -ENOMEM; 1448 }
1449 } 1449 if ((chip->dma.addr + chip->dma.bytes - 1) & ~((1 << 28) - 1)) {
1450 if ((chip->dma.addr + chip->dma.bytes - 1) & ~((1 << 28) - 1)) { 1450 snd_dma_free_pages(&chip->dma);
1451 snd_dma_free_pages(&chip->dma); 1451 snd_printk(KERN_ERR "es1968: DMA buffer beyond 256MB.\n");
1452 snd_printk(KERN_ERR "es1968: DMA buffer beyond 256MB.\n"); 1452 return -ENOMEM;
1453 return -ENOMEM;
1454 }
1455 } 1453 }
1456 1454
1457 INIT_LIST_HEAD(&chip->buf_list); 1455 INIT_LIST_HEAD(&chip->buf_list);
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index f59a321a6d6a..bd90c80bb494 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -584,10 +584,6 @@ static int snd_hammerfall_get_buffer(struct pci_dev *pci, struct snd_dma_buffer
584{ 584{
585 dmab->dev.type = SNDRV_DMA_TYPE_DEV; 585 dmab->dev.type = SNDRV_DMA_TYPE_DEV;
586 dmab->dev.dev = snd_dma_pci_data(pci); 586 dmab->dev.dev = snd_dma_pci_data(pci);
587 if (snd_dma_get_reserved_buf(dmab, snd_dma_pci_buf_id(pci))) {
588 if (dmab->bytes >= size)
589 return 0;
590 }
591 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 587 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
592 size, dmab) < 0) 588 size, dmab) < 0)
593 return -ENOMEM; 589 return -ENOMEM;
@@ -596,10 +592,8 @@ static int snd_hammerfall_get_buffer(struct pci_dev *pci, struct snd_dma_buffer
596 592
597static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_dev *pci) 593static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_dev *pci)
598{ 594{
599 if (dmab->area) { 595 if (dmab->area)
600 dmab->dev.dev = NULL; /* make it anonymous */ 596 snd_dma_free_pages(dmab);
601 snd_dma_reserve_buf(dmab, snd_dma_pci_buf_id(pci));
602 }
603} 597}
604 598
605 599
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index 3717f2dd30be..1503ee3585fd 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -294,10 +294,6 @@ static int snd_hammerfall_get_buffer(struct pci_dev *pci, struct snd_dma_buffer
294{ 294{
295 dmab->dev.type = SNDRV_DMA_TYPE_DEV; 295 dmab->dev.type = SNDRV_DMA_TYPE_DEV;
296 dmab->dev.dev = snd_dma_pci_data(pci); 296 dmab->dev.dev = snd_dma_pci_data(pci);
297 if (snd_dma_get_reserved_buf(dmab, snd_dma_pci_buf_id(pci))) {
298 if (dmab->bytes >= size)
299 return 0;
300 }
301 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 297 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
302 size, dmab) < 0) 298 size, dmab) < 0)
303 return -ENOMEM; 299 return -ENOMEM;
@@ -306,10 +302,8 @@ static int snd_hammerfall_get_buffer(struct pci_dev *pci, struct snd_dma_buffer
306 302
307static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_dev *pci) 303static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_dev *pci)
308{ 304{
309 if (dmab->area) { 305 if (dmab->area)
310 dmab->dev.dev = NULL; /* make it anonymous */ 306 snd_dma_free_pages(dmab);
311 snd_dma_reserve_buf(dmab, snd_dma_pci_buf_id(pci));
312 }
313} 307}
314 308
315 309