aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pcmcia
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2009-12-18 03:29:49 -0500
committerTakashi Iwai <tiwai@suse.de>2009-12-18 06:57:04 -0500
commitd20fb5dc076a4cf0fdd00ab5a4e752ea3611e484 (patch)
tree7ee93ec7ac012e27baaeb3c7a9348959966c643d /sound/pcmcia
parent681b84e17747e1c208e8e1acc54cc5e612da84d1 (diff)
sound: pdaudiocf: use vmalloc buffer helper functions
Remove this duplicate of snd_pcm_alloc_vmalloc_buffer and use the equivalent core functions instead. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pcmcia')
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c51
1 files changed, 4 insertions, 47 deletions
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
index 5cfa608823f7..0afa683c900e 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
@@ -21,7 +21,6 @@
21 */ 21 */
22 22
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/vmalloc.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
26#include <sound/core.h> 25#include <sound/core.h>
27#include <sound/asoundef.h> 26#include <sound/asoundef.h>
@@ -29,49 +28,6 @@
29 28
30 29
31/* 30/*
32 * we use a vmalloc'ed (sg-)buffer
33 */
34
35/* get the physical page pointer on the given offset */
36static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, unsigned long offset)
37{
38 void *pageptr = subs->runtime->dma_area + offset;
39 return vmalloc_to_page(pageptr);
40}
41
42/*
43 * hw_params callback
44 * NOTE: this may be called not only once per pcm open!
45 */
46static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size)
47{
48 struct snd_pcm_runtime *runtime = subs->runtime;
49 if (runtime->dma_area) {
50 if (runtime->dma_bytes >= size)
51 return 0; /* already enough large */
52 vfree(runtime->dma_area);
53 }
54 runtime->dma_area = vmalloc_32_user(size);
55 if (! runtime->dma_area)
56 return -ENOMEM;
57 runtime->dma_bytes = size;
58 return 0;
59}
60
61/*
62 * hw_free callback
63 * NOTE: this may be called not only once per pcm open!
64 */
65static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs)
66{
67 struct snd_pcm_runtime *runtime = subs->runtime;
68
69 vfree(runtime->dma_area);
70 runtime->dma_area = NULL;
71 return 0;
72}
73
74/*
75 * clear the SRAM contents 31 * clear the SRAM contents
76 */ 32 */
77static int pdacf_pcm_clear_sram(struct snd_pdacf *chip) 33static int pdacf_pcm_clear_sram(struct snd_pdacf *chip)
@@ -147,7 +103,8 @@ static int pdacf_pcm_trigger(struct snd_pcm_substream *subs, int cmd)
147static int pdacf_pcm_hw_params(struct snd_pcm_substream *subs, 103static int pdacf_pcm_hw_params(struct snd_pcm_substream *subs,
148 struct snd_pcm_hw_params *hw_params) 104 struct snd_pcm_hw_params *hw_params)
149{ 105{
150 return snd_pcm_alloc_vmalloc_buffer(subs, params_buffer_bytes(hw_params)); 106 return snd_pcm_lib_alloc_vmalloc_32_buffer
107 (subs, params_buffer_bytes(hw_params));
151} 108}
152 109
153/* 110/*
@@ -155,7 +112,7 @@ static int pdacf_pcm_hw_params(struct snd_pcm_substream *subs,
155 */ 112 */
156static int pdacf_pcm_hw_free(struct snd_pcm_substream *subs) 113static int pdacf_pcm_hw_free(struct snd_pcm_substream *subs)
157{ 114{
158 return snd_pcm_free_vmalloc_buffer(subs); 115 return snd_pcm_lib_free_vmalloc_buffer(subs);
159} 116}
160 117
161/* 118/*
@@ -319,7 +276,7 @@ static struct snd_pcm_ops pdacf_pcm_capture_ops = {
319 .prepare = pdacf_pcm_prepare, 276 .prepare = pdacf_pcm_prepare,
320 .trigger = pdacf_pcm_trigger, 277 .trigger = pdacf_pcm_trigger,
321 .pointer = pdacf_pcm_capture_pointer, 278 .pointer = pdacf_pcm_capture_pointer,
322 .page = snd_pcm_get_vmalloc_page, 279 .page = snd_pcm_lib_get_vmalloc_page,
323}; 280};
324 281
325 282