aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/pcm_memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/pcm_memory.c')
-rw-r--r--sound/core/pcm_memory.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index 0af622c34e19..01f8eafebda6 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -53,15 +53,6 @@ static int preallocate_pcm_pages(struct snd_pcm_substream *substream, size_t siz
53 struct snd_dma_buffer *dmab = &substream->dma_buffer; 53 struct snd_dma_buffer *dmab = &substream->dma_buffer;
54 int err; 54 int err;
55 55
56 /* already reserved? */
57 if (snd_dma_get_reserved_buf(dmab, substream->dma_buf_id) > 0) {
58 if (dmab->bytes >= size)
59 return 0; /* yes */
60 /* no, free the reserved block */
61 snd_dma_free_pages(dmab);
62 dmab->bytes = 0;
63 }
64
65 do { 56 do {
66 if ((err = snd_dma_alloc_pages(dmab->dev.type, dmab->dev.dev, 57 if ((err = snd_dma_alloc_pages(dmab->dev.type, dmab->dev.dev,
67 size, dmab)) < 0) { 58 size, dmab)) < 0) {
@@ -82,10 +73,7 @@ static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream
82{ 73{
83 if (substream->dma_buffer.area == NULL) 74 if (substream->dma_buffer.area == NULL)
84 return; 75 return;
85 if (substream->dma_buf_id) 76 snd_dma_free_pages(&substream->dma_buffer);
86 snd_dma_reserve_buf(&substream->dma_buffer, substream->dma_buf_id);
87 else
88 snd_dma_free_pages(&substream->dma_buffer);
89 substream->dma_buffer.area = NULL; 77 substream->dma_buffer.area = NULL;
90} 78}
91 79
@@ -260,11 +248,6 @@ static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream,
260 * 248 *
261 * Do pre-allocation for the given DMA buffer type. 249 * Do pre-allocation for the given DMA buffer type.
262 * 250 *
263 * When substream->dma_buf_id is set, the function tries to look for
264 * the reserved buffer, and the buffer is not freed but reserved at
265 * destruction time. The dma_buf_id must be unique for all systems
266 * (in the same DMA buffer type) e.g. using snd_dma_pci_buf_id().
267 *
268 * Return: Zero if successful, or a negative error code on failure. 251 * Return: Zero if successful, or a negative error code on failure.
269 */ 252 */
270int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, 253int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,