.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Digital Audio (PCM) abstract layer |
---|
3 | 4 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
---|
4 | | - * |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
9 | | - * (at your option) any later version. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, |
---|
12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | | - * GNU General Public License for more details. |
---|
15 | | - * |
---|
16 | | - * You should have received a copy of the GNU General Public License |
---|
17 | | - * along with this program; if not, write to the Free Software |
---|
18 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
19 | | - * |
---|
20 | 5 | */ |
---|
21 | 6 | |
---|
22 | 7 | #include <linux/io.h> |
---|
.. | .. |
---|
30 | 15 | #include <sound/pcm.h> |
---|
31 | 16 | #include <sound/info.h> |
---|
32 | 17 | #include <sound/initval.h> |
---|
| 18 | +#include "pcm_local.h" |
---|
33 | 19 | |
---|
34 | 20 | static int preallocate_dma = 1; |
---|
35 | 21 | module_param(preallocate_dma, int, 0444); |
---|
.. | .. |
---|
41 | 27 | |
---|
42 | 28 | static const size_t snd_minimum_buffer = 16384; |
---|
43 | 29 | |
---|
| 30 | +static unsigned long max_alloc_per_card = 32UL * 1024UL * 1024UL; |
---|
| 31 | +module_param(max_alloc_per_card, ulong, 0644); |
---|
| 32 | +MODULE_PARM_DESC(max_alloc_per_card, "Max total allocation bytes per card."); |
---|
| 33 | + |
---|
| 34 | +static int do_alloc_pages(struct snd_card *card, int type, struct device *dev, |
---|
| 35 | + size_t size, struct snd_dma_buffer *dmab) |
---|
| 36 | +{ |
---|
| 37 | + int err; |
---|
| 38 | + |
---|
| 39 | + if (max_alloc_per_card && |
---|
| 40 | + card->total_pcm_alloc_bytes + size > max_alloc_per_card) |
---|
| 41 | + return -ENOMEM; |
---|
| 42 | + |
---|
| 43 | + err = snd_dma_alloc_pages(type, dev, size, dmab); |
---|
| 44 | + if (!err) { |
---|
| 45 | + mutex_lock(&card->memory_mutex); |
---|
| 46 | + card->total_pcm_alloc_bytes += dmab->bytes; |
---|
| 47 | + mutex_unlock(&card->memory_mutex); |
---|
| 48 | + } |
---|
| 49 | + return err; |
---|
| 50 | +} |
---|
| 51 | + |
---|
| 52 | +static void do_free_pages(struct snd_card *card, struct snd_dma_buffer *dmab) |
---|
| 53 | +{ |
---|
| 54 | + if (!dmab->area) |
---|
| 55 | + return; |
---|
| 56 | + mutex_lock(&card->memory_mutex); |
---|
| 57 | + WARN_ON(card->total_pcm_alloc_bytes < dmab->bytes); |
---|
| 58 | + card->total_pcm_alloc_bytes -= dmab->bytes; |
---|
| 59 | + mutex_unlock(&card->memory_mutex); |
---|
| 60 | + snd_dma_free_pages(dmab); |
---|
| 61 | + dmab->area = NULL; |
---|
| 62 | +} |
---|
44 | 63 | |
---|
45 | 64 | /* |
---|
46 | 65 | * try to allocate as the large pages as possible. |
---|
.. | .. |
---|
51 | 70 | static int preallocate_pcm_pages(struct snd_pcm_substream *substream, size_t size) |
---|
52 | 71 | { |
---|
53 | 72 | struct snd_dma_buffer *dmab = &substream->dma_buffer; |
---|
| 73 | + struct snd_card *card = substream->pcm->card; |
---|
54 | 74 | size_t orig_size = size; |
---|
55 | 75 | int err; |
---|
56 | 76 | |
---|
57 | 77 | do { |
---|
58 | | - if ((err = snd_dma_alloc_pages(dmab->dev.type, dmab->dev.dev, |
---|
59 | | - size, dmab)) < 0) { |
---|
60 | | - if (err != -ENOMEM) |
---|
61 | | - return err; /* fatal error */ |
---|
62 | | - } else |
---|
63 | | - return 0; |
---|
| 78 | + err = do_alloc_pages(card, dmab->dev.type, dmab->dev.dev, |
---|
| 79 | + size, dmab); |
---|
| 80 | + if (err != -ENOMEM) |
---|
| 81 | + return err; |
---|
64 | 82 | size >>= 1; |
---|
65 | 83 | } while (size >= snd_minimum_buffer); |
---|
66 | 84 | dmab->bytes = 0; /* tell error */ |
---|
.. | .. |
---|
76 | 94 | */ |
---|
77 | 95 | static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream) |
---|
78 | 96 | { |
---|
79 | | - if (substream->dma_buffer.area == NULL) |
---|
80 | | - return; |
---|
81 | | - snd_dma_free_pages(&substream->dma_buffer); |
---|
82 | | - substream->dma_buffer.area = NULL; |
---|
| 97 | + do_free_pages(substream->pcm->card, &substream->dma_buffer); |
---|
83 | 98 | } |
---|
84 | 99 | |
---|
85 | 100 | /** |
---|
.. | .. |
---|
87 | 102 | * @substream: the pcm substream instance |
---|
88 | 103 | * |
---|
89 | 104 | * Releases the pre-allocated buffer of the given substream. |
---|
90 | | - * |
---|
91 | | - * Return: Zero if successful, or a negative error code on failure. |
---|
92 | 105 | */ |
---|
93 | | -int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) |
---|
| 106 | +void snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) |
---|
94 | 107 | { |
---|
95 | 108 | snd_pcm_lib_preallocate_dma_free(substream); |
---|
96 | | -#ifdef CONFIG_SND_VERBOSE_PROCFS |
---|
97 | | - snd_info_free_entry(substream->proc_prealloc_max_entry); |
---|
98 | | - substream->proc_prealloc_max_entry = NULL; |
---|
99 | | - snd_info_free_entry(substream->proc_prealloc_entry); |
---|
100 | | - substream->proc_prealloc_entry = NULL; |
---|
101 | | -#endif |
---|
102 | | - return 0; |
---|
103 | 109 | } |
---|
104 | 110 | |
---|
105 | 111 | /** |
---|
.. | .. |
---|
107 | 113 | * @pcm: the pcm instance |
---|
108 | 114 | * |
---|
109 | 115 | * Releases all the pre-allocated buffers on the given pcm. |
---|
110 | | - * |
---|
111 | | - * Return: Zero if successful, or a negative error code on failure. |
---|
112 | 116 | */ |
---|
113 | | -int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm) |
---|
| 117 | +void snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm) |
---|
114 | 118 | { |
---|
115 | 119 | struct snd_pcm_substream *substream; |
---|
116 | 120 | int stream; |
---|
.. | .. |
---|
118 | 122 | for (stream = 0; stream < 2; stream++) |
---|
119 | 123 | for (substream = pcm->streams[stream].substream; substream; substream = substream->next) |
---|
120 | 124 | snd_pcm_lib_preallocate_free(substream); |
---|
121 | | - return 0; |
---|
122 | 125 | } |
---|
123 | 126 | EXPORT_SYMBOL(snd_pcm_lib_preallocate_free_for_all); |
---|
124 | 127 | |
---|
.. | .. |
---|
156 | 159 | struct snd_info_buffer *buffer) |
---|
157 | 160 | { |
---|
158 | 161 | struct snd_pcm_substream *substream = entry->private_data; |
---|
| 162 | + struct snd_card *card = substream->pcm->card; |
---|
159 | 163 | char line[64], str[64]; |
---|
160 | 164 | size_t size; |
---|
161 | 165 | struct snd_dma_buffer new_dmab; |
---|
162 | 166 | |
---|
| 167 | + mutex_lock(&substream->pcm->open_mutex); |
---|
163 | 168 | if (substream->runtime) { |
---|
164 | 169 | buffer->error = -EBUSY; |
---|
165 | | - return; |
---|
| 170 | + goto unlock; |
---|
166 | 171 | } |
---|
167 | 172 | if (!snd_info_get_line(buffer, line, sizeof(line))) { |
---|
168 | 173 | snd_info_get_str(str, line, sizeof(str)); |
---|
169 | 174 | size = simple_strtoul(str, NULL, 10) * 1024; |
---|
170 | 175 | if ((size != 0 && size < 8192) || size > substream->dma_max) { |
---|
171 | 176 | buffer->error = -EINVAL; |
---|
172 | | - return; |
---|
| 177 | + goto unlock; |
---|
173 | 178 | } |
---|
174 | 179 | if (substream->dma_buffer.bytes == size) |
---|
175 | | - return; |
---|
| 180 | + goto unlock; |
---|
176 | 181 | memset(&new_dmab, 0, sizeof(new_dmab)); |
---|
177 | 182 | new_dmab.dev = substream->dma_buffer.dev; |
---|
178 | 183 | if (size > 0) { |
---|
179 | | - if (snd_dma_alloc_pages(substream->dma_buffer.dev.type, |
---|
180 | | - substream->dma_buffer.dev.dev, |
---|
181 | | - size, &new_dmab) < 0) { |
---|
| 184 | + if (do_alloc_pages(card, |
---|
| 185 | + substream->dma_buffer.dev.type, |
---|
| 186 | + substream->dma_buffer.dev.dev, |
---|
| 187 | + size, &new_dmab) < 0) { |
---|
182 | 188 | buffer->error = -ENOMEM; |
---|
183 | | - return; |
---|
| 189 | + goto unlock; |
---|
184 | 190 | } |
---|
185 | 191 | substream->buffer_bytes_max = size; |
---|
186 | 192 | } else { |
---|
187 | 193 | substream->buffer_bytes_max = UINT_MAX; |
---|
188 | 194 | } |
---|
189 | 195 | if (substream->dma_buffer.area) |
---|
190 | | - snd_dma_free_pages(&substream->dma_buffer); |
---|
| 196 | + do_free_pages(card, &substream->dma_buffer); |
---|
191 | 197 | substream->dma_buffer = new_dmab; |
---|
192 | 198 | } else { |
---|
193 | 199 | buffer->error = -EINVAL; |
---|
194 | 200 | } |
---|
| 201 | + unlock: |
---|
| 202 | + mutex_unlock(&substream->pcm->open_mutex); |
---|
195 | 203 | } |
---|
196 | 204 | |
---|
197 | 205 | static inline void preallocate_info_init(struct snd_pcm_substream *substream) |
---|
198 | 206 | { |
---|
199 | 207 | struct snd_info_entry *entry; |
---|
200 | 208 | |
---|
201 | | - if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", substream->proc_root)) != NULL) { |
---|
202 | | - entry->c.text.read = snd_pcm_lib_preallocate_proc_read; |
---|
| 209 | + entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", |
---|
| 210 | + substream->proc_root); |
---|
| 211 | + if (entry) { |
---|
| 212 | + snd_info_set_text_ops(entry, substream, |
---|
| 213 | + snd_pcm_lib_preallocate_proc_read); |
---|
203 | 214 | entry->c.text.write = snd_pcm_lib_preallocate_proc_write; |
---|
204 | 215 | entry->mode |= 0200; |
---|
205 | | - entry->private_data = substream; |
---|
206 | | - if (snd_info_register(entry) < 0) { |
---|
207 | | - snd_info_free_entry(entry); |
---|
208 | | - entry = NULL; |
---|
209 | | - } |
---|
210 | 216 | } |
---|
211 | | - substream->proc_prealloc_entry = entry; |
---|
212 | | - if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc_max", substream->proc_root)) != NULL) { |
---|
213 | | - entry->c.text.read = snd_pcm_lib_preallocate_max_proc_read; |
---|
214 | | - entry->private_data = substream; |
---|
215 | | - if (snd_info_register(entry) < 0) { |
---|
216 | | - snd_info_free_entry(entry); |
---|
217 | | - entry = NULL; |
---|
218 | | - } |
---|
219 | | - } |
---|
220 | | - substream->proc_prealloc_max_entry = entry; |
---|
| 217 | + entry = snd_info_create_card_entry(substream->pcm->card, "prealloc_max", |
---|
| 218 | + substream->proc_root); |
---|
| 219 | + if (entry) |
---|
| 220 | + snd_info_set_text_ops(entry, substream, |
---|
| 221 | + snd_pcm_lib_preallocate_max_proc_read); |
---|
221 | 222 | } |
---|
222 | 223 | |
---|
223 | 224 | #else /* !CONFIG_SND_VERBOSE_PROCFS */ |
---|
.. | .. |
---|
227 | 228 | /* |
---|
228 | 229 | * pre-allocate the buffer and create a proc file for the substream |
---|
229 | 230 | */ |
---|
230 | | -static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream, |
---|
231 | | - size_t size, size_t max) |
---|
| 231 | +static void preallocate_pages(struct snd_pcm_substream *substream, |
---|
| 232 | + int type, struct device *data, |
---|
| 233 | + size_t size, size_t max, bool managed) |
---|
232 | 234 | { |
---|
| 235 | + if (snd_BUG_ON(substream->dma_buffer.dev.type)) |
---|
| 236 | + return; |
---|
| 237 | + |
---|
| 238 | + substream->dma_buffer.dev.type = type; |
---|
| 239 | + substream->dma_buffer.dev.dev = data; |
---|
233 | 240 | |
---|
234 | 241 | if (size > 0 && preallocate_dma && substream->number < maximum_substreams) |
---|
235 | 242 | preallocate_pcm_pages(substream, size); |
---|
.. | .. |
---|
237 | 244 | if (substream->dma_buffer.bytes > 0) |
---|
238 | 245 | substream->buffer_bytes_max = substream->dma_buffer.bytes; |
---|
239 | 246 | substream->dma_max = max; |
---|
240 | | - preallocate_info_init(substream); |
---|
241 | | - return 0; |
---|
| 247 | + if (max > 0) |
---|
| 248 | + preallocate_info_init(substream); |
---|
| 249 | + if (managed) |
---|
| 250 | + substream->managed_buffer_alloc = 1; |
---|
242 | 251 | } |
---|
243 | 252 | |
---|
| 253 | +static void preallocate_pages_for_all(struct snd_pcm *pcm, int type, |
---|
| 254 | + void *data, size_t size, size_t max, |
---|
| 255 | + bool managed) |
---|
| 256 | +{ |
---|
| 257 | + struct snd_pcm_substream *substream; |
---|
| 258 | + int stream; |
---|
| 259 | + |
---|
| 260 | + for (stream = 0; stream < 2; stream++) |
---|
| 261 | + for (substream = pcm->streams[stream].substream; substream; |
---|
| 262 | + substream = substream->next) |
---|
| 263 | + preallocate_pages(substream, type, data, size, max, |
---|
| 264 | + managed); |
---|
| 265 | +} |
---|
244 | 266 | |
---|
245 | 267 | /** |
---|
246 | 268 | * snd_pcm_lib_preallocate_pages - pre-allocation for the given DMA type |
---|
.. | .. |
---|
251 | 273 | * @max: the max. allowed pre-allocation size |
---|
252 | 274 | * |
---|
253 | 275 | * Do pre-allocation for the given DMA buffer type. |
---|
254 | | - * |
---|
255 | | - * Return: Zero if successful, or a negative error code on failure. |
---|
256 | 276 | */ |
---|
257 | | -int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, |
---|
| 277 | +void snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, |
---|
258 | 278 | int type, struct device *data, |
---|
259 | 279 | size_t size, size_t max) |
---|
260 | 280 | { |
---|
261 | | - substream->dma_buffer.dev.type = type; |
---|
262 | | - substream->dma_buffer.dev.dev = data; |
---|
263 | | - return snd_pcm_lib_preallocate_pages1(substream, size, max); |
---|
| 281 | + preallocate_pages(substream, type, data, size, max, false); |
---|
264 | 282 | } |
---|
265 | 283 | EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages); |
---|
266 | 284 | |
---|
.. | .. |
---|
274 | 292 | * |
---|
275 | 293 | * Do pre-allocation to all substreams of the given pcm for the |
---|
276 | 294 | * specified DMA type. |
---|
277 | | - * |
---|
278 | | - * Return: Zero if successful, or a negative error code on failure. |
---|
279 | 295 | */ |
---|
280 | | -int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, |
---|
| 296 | +void snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, |
---|
281 | 297 | int type, void *data, |
---|
282 | 298 | size_t size, size_t max) |
---|
283 | 299 | { |
---|
284 | | - struct snd_pcm_substream *substream; |
---|
285 | | - int stream, err; |
---|
286 | | - |
---|
287 | | - for (stream = 0; stream < 2; stream++) |
---|
288 | | - for (substream = pcm->streams[stream].substream; substream; substream = substream->next) |
---|
289 | | - if ((err = snd_pcm_lib_preallocate_pages(substream, type, data, size, max)) < 0) |
---|
290 | | - return err; |
---|
291 | | - return 0; |
---|
| 300 | + preallocate_pages_for_all(pcm, type, data, size, max, false); |
---|
292 | 301 | } |
---|
293 | 302 | EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages_for_all); |
---|
294 | 303 | |
---|
295 | | -#ifdef CONFIG_SND_DMA_SGBUF |
---|
296 | 304 | /** |
---|
| 305 | + * snd_pcm_set_managed_buffer - set up buffer management for a substream |
---|
| 306 | + * @substream: the pcm substream instance |
---|
| 307 | + * @type: DMA type (SNDRV_DMA_TYPE_*) |
---|
| 308 | + * @data: DMA type dependent data |
---|
| 309 | + * @size: the requested pre-allocation size in bytes |
---|
| 310 | + * @max: the max. allowed pre-allocation size |
---|
| 311 | + * |
---|
| 312 | + * Do pre-allocation for the given DMA buffer type, and set the managed |
---|
| 313 | + * buffer allocation mode to the given substream. |
---|
| 314 | + * In this mode, PCM core will allocate a buffer automatically before PCM |
---|
| 315 | + * hw_params ops call, and release the buffer after PCM hw_free ops call |
---|
| 316 | + * as well, so that the driver doesn't need to invoke the allocation and |
---|
| 317 | + * the release explicitly in its callback. |
---|
| 318 | + * When a buffer is actually allocated before the PCM hw_params call, it |
---|
| 319 | + * turns on the runtime buffer_changed flag for drivers changing their h/w |
---|
| 320 | + * parameters accordingly. |
---|
| 321 | + */ |
---|
| 322 | +void snd_pcm_set_managed_buffer(struct snd_pcm_substream *substream, int type, |
---|
| 323 | + struct device *data, size_t size, size_t max) |
---|
| 324 | +{ |
---|
| 325 | + preallocate_pages(substream, type, data, size, max, true); |
---|
| 326 | +} |
---|
| 327 | +EXPORT_SYMBOL(snd_pcm_set_managed_buffer); |
---|
| 328 | + |
---|
| 329 | +/** |
---|
| 330 | + * snd_pcm_set_managed_buffer_all - set up buffer management for all substreams |
---|
| 331 | + * for all substreams |
---|
| 332 | + * @pcm: the pcm instance |
---|
| 333 | + * @type: DMA type (SNDRV_DMA_TYPE_*) |
---|
| 334 | + * @data: DMA type dependent data |
---|
| 335 | + * @size: the requested pre-allocation size in bytes |
---|
| 336 | + * @max: the max. allowed pre-allocation size |
---|
| 337 | + * |
---|
| 338 | + * Do pre-allocation to all substreams of the given pcm for the specified DMA |
---|
| 339 | + * type and size, and set the managed_buffer_alloc flag to each substream. |
---|
| 340 | + */ |
---|
| 341 | +void snd_pcm_set_managed_buffer_all(struct snd_pcm *pcm, int type, |
---|
| 342 | + struct device *data, |
---|
| 343 | + size_t size, size_t max) |
---|
| 344 | +{ |
---|
| 345 | + preallocate_pages_for_all(pcm, type, data, size, max, true); |
---|
| 346 | +} |
---|
| 347 | +EXPORT_SYMBOL(snd_pcm_set_managed_buffer_all); |
---|
| 348 | + |
---|
| 349 | +#ifdef CONFIG_SND_DMA_SGBUF |
---|
| 350 | +/* |
---|
297 | 351 | * snd_pcm_sgbuf_ops_page - get the page struct at the given offset |
---|
298 | 352 | * @substream: the pcm substream instance |
---|
299 | 353 | * @offset: the buffer offset |
---|
.. | .. |
---|
311 | 365 | return NULL; |
---|
312 | 366 | return sgbuf->page_table[idx]; |
---|
313 | 367 | } |
---|
314 | | -EXPORT_SYMBOL(snd_pcm_sgbuf_ops_page); |
---|
315 | 368 | #endif /* CONFIG_SND_DMA_SGBUF */ |
---|
316 | 369 | |
---|
317 | 370 | /** |
---|
.. | .. |
---|
327 | 380 | */ |
---|
328 | 381 | int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size) |
---|
329 | 382 | { |
---|
| 383 | + struct snd_card *card; |
---|
330 | 384 | struct snd_pcm_runtime *runtime; |
---|
331 | 385 | struct snd_dma_buffer *dmab = NULL; |
---|
332 | 386 | |
---|
.. | .. |
---|
336 | 390 | SNDRV_DMA_TYPE_UNKNOWN)) |
---|
337 | 391 | return -EINVAL; |
---|
338 | 392 | runtime = substream->runtime; |
---|
| 393 | + card = substream->pcm->card; |
---|
339 | 394 | |
---|
340 | 395 | if (runtime->dma_buffer_p) { |
---|
341 | 396 | /* perphaps, we might free the large DMA memory region |
---|
.. | .. |
---|
355 | 410 | if (! dmab) |
---|
356 | 411 | return -ENOMEM; |
---|
357 | 412 | dmab->dev = substream->dma_buffer.dev; |
---|
358 | | - if (snd_dma_alloc_pages(substream->dma_buffer.dev.type, |
---|
359 | | - substream->dma_buffer.dev.dev, |
---|
360 | | - size, dmab) < 0) { |
---|
| 413 | + if (do_alloc_pages(card, |
---|
| 414 | + substream->dma_buffer.dev.type, |
---|
| 415 | + substream->dma_buffer.dev.dev, |
---|
| 416 | + size, dmab) < 0) { |
---|
361 | 417 | kfree(dmab); |
---|
362 | 418 | return -ENOMEM; |
---|
363 | 419 | } |
---|
.. | .. |
---|
386 | 442 | if (runtime->dma_area == NULL) |
---|
387 | 443 | return 0; |
---|
388 | 444 | if (runtime->dma_buffer_p != &substream->dma_buffer) { |
---|
| 445 | + struct snd_card *card = substream->pcm->card; |
---|
| 446 | + |
---|
389 | 447 | /* it's a newly allocated buffer. release it now. */ |
---|
390 | | - snd_dma_free_pages(runtime->dma_buffer_p); |
---|
| 448 | + do_free_pages(card, runtime->dma_buffer_p); |
---|
391 | 449 | kfree(runtime->dma_buffer_p); |
---|
392 | 450 | } |
---|
393 | 451 | snd_pcm_set_runtime_buffer(substream, NULL); |
---|
.. | .. |
---|
408 | 466 | return 0; /* already large enough */ |
---|
409 | 467 | vfree(runtime->dma_area); |
---|
410 | 468 | } |
---|
411 | | - runtime->dma_area = __vmalloc(size, gfp_flags, PAGE_KERNEL); |
---|
| 469 | + runtime->dma_area = __vmalloc(size, gfp_flags); |
---|
412 | 470 | if (!runtime->dma_area) |
---|
413 | 471 | return -ENOMEM; |
---|
414 | 472 | runtime->dma_bytes = size; |
---|