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.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index b3f5344f60b..d37bcb76188 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -46,7 +46,7 @@ static const size_t snd_minimum_buffer = 16384;
46 * 46 *
47 * the minimum size is snd_minimum_buffer. it should be power of 2. 47 * the minimum size is snd_minimum_buffer. it should be power of 2.
48 */ 48 */
49static int preallocate_pcm_pages(snd_pcm_substream_t *substream, size_t size) 49static int preallocate_pcm_pages(struct snd_pcm_substream *substream, size_t size)
50{ 50{
51 struct snd_dma_buffer *dmab = &substream->dma_buffer; 51 struct snd_dma_buffer *dmab = &substream->dma_buffer;
52 int err; 52 int err;
@@ -78,7 +78,7 @@ static int preallocate_pcm_pages(snd_pcm_substream_t *substream, size_t size)
78/* 78/*
79 * release the preallocated buffer if not yet done. 79 * release the preallocated buffer if not yet done.
80 */ 80 */
81static void snd_pcm_lib_preallocate_dma_free(snd_pcm_substream_t *substream) 81static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream)
82{ 82{
83 if (substream->dma_buffer.area == NULL) 83 if (substream->dma_buffer.area == NULL)
84 return; 84 return;
@@ -97,7 +97,7 @@ static void snd_pcm_lib_preallocate_dma_free(snd_pcm_substream_t *substream)
97 * 97 *
98 * Returns zero if successful, or a negative error code on failure. 98 * Returns zero if successful, or a negative error code on failure.
99 */ 99 */
100int snd_pcm_lib_preallocate_free(snd_pcm_substream_t *substream) 100int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream)
101{ 101{
102 snd_pcm_lib_preallocate_dma_free(substream); 102 snd_pcm_lib_preallocate_dma_free(substream);
103 if (substream->proc_prealloc_entry) { 103 if (substream->proc_prealloc_entry) {
@@ -115,9 +115,9 @@ int snd_pcm_lib_preallocate_free(snd_pcm_substream_t *substream)
115 * 115 *
116 * Returns zero if successful, or a negative error code on failure. 116 * Returns zero if successful, or a negative error code on failure.
117 */ 117 */
118int snd_pcm_lib_preallocate_free_for_all(snd_pcm_t *pcm) 118int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm)
119{ 119{
120 snd_pcm_substream_t *substream; 120 struct snd_pcm_substream *substream;
121 int stream; 121 int stream;
122 122
123 for (stream = 0; stream < 2; stream++) 123 for (stream = 0; stream < 2; stream++)
@@ -131,10 +131,10 @@ int snd_pcm_lib_preallocate_free_for_all(snd_pcm_t *pcm)
131 * 131 *
132 * prints the current allocated size in kB. 132 * prints the current allocated size in kB.
133 */ 133 */
134static void snd_pcm_lib_preallocate_proc_read(snd_info_entry_t *entry, 134static void snd_pcm_lib_preallocate_proc_read(struct snd_info_entry *entry,
135 snd_info_buffer_t *buffer) 135 struct snd_info_buffer *buffer)
136{ 136{
137 snd_pcm_substream_t *substream = (snd_pcm_substream_t *)entry->private_data; 137 struct snd_pcm_substream *substream = entry->private_data;
138 snd_iprintf(buffer, "%lu\n", (unsigned long) substream->dma_buffer.bytes / 1024); 138 snd_iprintf(buffer, "%lu\n", (unsigned long) substream->dma_buffer.bytes / 1024);
139} 139}
140 140
@@ -143,10 +143,10 @@ static void snd_pcm_lib_preallocate_proc_read(snd_info_entry_t *entry,
143 * 143 *
144 * accepts the preallocation size in kB. 144 * accepts the preallocation size in kB.
145 */ 145 */
146static void snd_pcm_lib_preallocate_proc_write(snd_info_entry_t *entry, 146static void snd_pcm_lib_preallocate_proc_write(struct snd_info_entry *entry,
147 snd_info_buffer_t *buffer) 147 struct snd_info_buffer *buffer)
148{ 148{
149 snd_pcm_substream_t *substream = (snd_pcm_substream_t *)entry->private_data; 149 struct snd_pcm_substream *substream = entry->private_data;
150 char line[64], str[64]; 150 char line[64], str[64];
151 size_t size; 151 size_t size;
152 struct snd_dma_buffer new_dmab; 152 struct snd_dma_buffer new_dmab;
@@ -188,10 +188,10 @@ static void snd_pcm_lib_preallocate_proc_write(snd_info_entry_t *entry,
188/* 188/*
189 * pre-allocate the buffer and create a proc file for the substream 189 * pre-allocate the buffer and create a proc file for the substream
190 */ 190 */
191static int snd_pcm_lib_preallocate_pages1(snd_pcm_substream_t *substream, 191static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream,
192 size_t size, size_t max) 192 size_t size, size_t max)
193{ 193{
194 snd_info_entry_t *entry; 194 struct snd_info_entry *entry;
195 195
196 if (size > 0 && preallocate_dma && substream->number < maximum_substreams) 196 if (size > 0 && preallocate_dma && substream->number < maximum_substreams)
197 preallocate_pcm_pages(substream, size); 197 preallocate_pcm_pages(substream, size);
@@ -233,7 +233,7 @@ static int snd_pcm_lib_preallocate_pages1(snd_pcm_substream_t *substream,
233 * 233 *
234 * Returns zero if successful, or a negative error code on failure. 234 * Returns zero if successful, or a negative error code on failure.
235 */ 235 */
236int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream, 236int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,
237 int type, struct device *data, 237 int type, struct device *data,
238 size_t size, size_t max) 238 size_t size, size_t max)
239{ 239{
@@ -255,11 +255,11 @@ int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream,
255 * 255 *
256 * Returns zero if successful, or a negative error code on failure. 256 * Returns zero if successful, or a negative error code on failure.
257 */ 257 */
258int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm, 258int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
259 int type, void *data, 259 int type, void *data,
260 size_t size, size_t max) 260 size_t size, size_t max)
261{ 261{
262 snd_pcm_substream_t *substream; 262 struct snd_pcm_substream *substream;
263 int stream, err; 263 int stream, err;
264 264
265 for (stream = 0; stream < 2; stream++) 265 for (stream = 0; stream < 2; stream++)
@@ -277,7 +277,7 @@ int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm,
277 * Returns the page struct at the given buffer offset. 277 * Returns the page struct at the given buffer offset.
278 * Used as the page callback of PCM ops. 278 * Used as the page callback of PCM ops.
279 */ 279 */
280struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned long offset) 280struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset)
281{ 281{
282 struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); 282 struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream);
283 283
@@ -298,9 +298,9 @@ struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned lon
298 * Returns 1 if the buffer is changed, 0 if not changed, or a negative 298 * Returns 1 if the buffer is changed, 0 if not changed, or a negative
299 * code on failure. 299 * code on failure.
300 */ 300 */
301int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size) 301int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size)
302{ 302{
303 snd_pcm_runtime_t *runtime; 303 struct snd_pcm_runtime *runtime;
304 struct snd_dma_buffer *dmab = NULL; 304 struct snd_dma_buffer *dmab = NULL;
305 305
306 snd_assert(substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_UNKNOWN, return -EINVAL); 306 snd_assert(substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_UNKNOWN, return -EINVAL);
@@ -318,7 +318,8 @@ int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size)
318 } 318 }
319 snd_pcm_lib_free_pages(substream); 319 snd_pcm_lib_free_pages(substream);
320 } 320 }
321 if (substream->dma_buffer.area != NULL && substream->dma_buffer.bytes >= size) { 321 if (substream->dma_buffer.area != NULL &&
322 substream->dma_buffer.bytes >= size) {
322 dmab = &substream->dma_buffer; /* use the pre-allocated buffer */ 323 dmab = &substream->dma_buffer; /* use the pre-allocated buffer */
323 } else { 324 } else {
324 dmab = kzalloc(sizeof(*dmab), GFP_KERNEL); 325 dmab = kzalloc(sizeof(*dmab), GFP_KERNEL);
@@ -345,9 +346,9 @@ int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size)
345 * 346 *
346 * Returns zero if successful, or a negative error code on failure. 347 * Returns zero if successful, or a negative error code on failure.
347 */ 348 */
348int snd_pcm_lib_free_pages(snd_pcm_substream_t *substream) 349int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream)
349{ 350{
350 snd_pcm_runtime_t *runtime; 351 struct snd_pcm_runtime *runtime;
351 352
352 snd_assert(substream != NULL, return -EINVAL); 353 snd_assert(substream != NULL, return -EINVAL);
353 runtime = substream->runtime; 354 runtime = substream->runtime;