From d20fb5dc076a4cf0fdd00ab5a4e752ea3611e484 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 18 Dec 2009 09:29:49 +0100 Subject: 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 Signed-off-by: Takashi Iwai --- sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 51 +++------------------------------- 1 file changed, 4 insertions(+), 47 deletions(-) (limited to 'sound') diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c index 5cfa608823f..0afa683c900 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c @@ -21,56 +21,12 @@ */ #include -#include #include #include #include #include "pdaudiocf.h" -/* - * we use a vmalloc'ed (sg-)buffer - */ - -/* get the physical page pointer on the given offset */ -static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, unsigned long offset) -{ - void *pageptr = subs->runtime->dma_area + offset; - return vmalloc_to_page(pageptr); -} - -/* - * hw_params callback - * NOTE: this may be called not only once per pcm open! - */ -static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size) -{ - struct snd_pcm_runtime *runtime = subs->runtime; - if (runtime->dma_area) { - if (runtime->dma_bytes >= size) - return 0; /* already enough large */ - vfree(runtime->dma_area); - } - runtime->dma_area = vmalloc_32_user(size); - if (! runtime->dma_area) - return -ENOMEM; - runtime->dma_bytes = size; - return 0; -} - -/* - * hw_free callback - * NOTE: this may be called not only once per pcm open! - */ -static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs) -{ - struct snd_pcm_runtime *runtime = subs->runtime; - - vfree(runtime->dma_area); - runtime->dma_area = NULL; - return 0; -} - /* * clear the SRAM contents */ @@ -147,7 +103,8 @@ static int pdacf_pcm_trigger(struct snd_pcm_substream *subs, int cmd) static int pdacf_pcm_hw_params(struct snd_pcm_substream *subs, struct snd_pcm_hw_params *hw_params) { - return snd_pcm_alloc_vmalloc_buffer(subs, params_buffer_bytes(hw_params)); + return snd_pcm_lib_alloc_vmalloc_32_buffer + (subs, params_buffer_bytes(hw_params)); } /* @@ -155,7 +112,7 @@ static int pdacf_pcm_hw_params(struct snd_pcm_substream *subs, */ static int pdacf_pcm_hw_free(struct snd_pcm_substream *subs) { - return snd_pcm_free_vmalloc_buffer(subs); + return snd_pcm_lib_free_vmalloc_buffer(subs); } /* @@ -319,7 +276,7 @@ static struct snd_pcm_ops pdacf_pcm_capture_ops = { .prepare = pdacf_pcm_prepare, .trigger = pdacf_pcm_trigger, .pointer = pdacf_pcm_capture_pointer, - .page = snd_pcm_get_vmalloc_page, + .page = snd_pcm_lib_get_vmalloc_page, }; -- cgit v1.2.3