From b0af0c0312e23e3edb7d9054f84d7ed1407430cf Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 18 Dec 2009 09:30:24 +0100 Subject: [PATCH] --- yaml --- r: 182679 b: refs/heads/master c: 6cedf8696d6a01bba391bdae06231243cfe2f48a h: refs/heads/master i: 182677: 1eb8d87cc28e7a39a22b9793e1694d65a0990748 182675: 1ce917c2cd2ee18fda28a07b905c2cb68edcccc6 182671: 13284a505167f3af47b356fb21eba8a9369c4709 v: v3 --- [refs] | 2 +- trunk/sound/mips/sgio2audio.c | 31 ++++++------------------------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/[refs] b/[refs] index 79112956d071..423579676bcf 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d20fb5dc076a4cf0fdd00ab5a4e752ea3611e484 +refs/heads/master: 6cedf8696d6a01bba391bdae06231243cfe2f48a diff --git a/trunk/sound/mips/sgio2audio.c b/trunk/sound/mips/sgio2audio.c index f1d9d16b5486..9b486beeb932 100644 --- a/trunk/sound/mips/sgio2audio.c +++ b/trunk/sound/mips/sgio2audio.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -603,25 +602,14 @@ static int snd_sgio2audio_pcm_close(struct snd_pcm_substream *substream) static int snd_sgio2audio_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) { - struct snd_pcm_runtime *runtime = substream->runtime; - int size = params_buffer_bytes(hw_params); - - /* alloc virtual 'dma' area */ - if (runtime->dma_area) - vfree(runtime->dma_area); - runtime->dma_area = vmalloc_user(size); - if (runtime->dma_area == NULL) - return -ENOMEM; - runtime->dma_bytes = size; - return 0; + return snd_pcm_lib_alloc_vmalloc_buffer(substream, + params_buffer_bytes(hw_params)); } /* hw_free callback */ static int snd_sgio2audio_pcm_hw_free(struct snd_pcm_substream *substream) { - vfree(substream->runtime->dma_area); - substream->runtime->dma_area = NULL; - return 0; + return snd_pcm_lib_free_vmalloc_buffer(substream); } /* prepare callback */ @@ -692,13 +680,6 @@ snd_sgio2audio_pcm_pointer(struct snd_pcm_substream *substream) chip->channel[chan->idx].pos); } -/* get the physical page pointer on the given offset */ -static struct page *snd_sgio2audio_page(struct snd_pcm_substream *substream, - unsigned long offset) -{ - return vmalloc_to_page(substream->runtime->dma_area + offset); -} - /* operators */ static struct snd_pcm_ops snd_sgio2audio_playback1_ops = { .open = snd_sgio2audio_playback1_open, @@ -709,7 +690,7 @@ static struct snd_pcm_ops snd_sgio2audio_playback1_ops = { .prepare = snd_sgio2audio_pcm_prepare, .trigger = snd_sgio2audio_pcm_trigger, .pointer = snd_sgio2audio_pcm_pointer, - .page = snd_sgio2audio_page, + .page = snd_pcm_lib_get_vmalloc_page, }; static struct snd_pcm_ops snd_sgio2audio_playback2_ops = { @@ -721,7 +702,7 @@ static struct snd_pcm_ops snd_sgio2audio_playback2_ops = { .prepare = snd_sgio2audio_pcm_prepare, .trigger = snd_sgio2audio_pcm_trigger, .pointer = snd_sgio2audio_pcm_pointer, - .page = snd_sgio2audio_page, + .page = snd_pcm_lib_get_vmalloc_page, }; static struct snd_pcm_ops snd_sgio2audio_capture_ops = { @@ -733,7 +714,7 @@ static struct snd_pcm_ops snd_sgio2audio_capture_ops = { .prepare = snd_sgio2audio_pcm_prepare, .trigger = snd_sgio2audio_pcm_trigger, .pointer = snd_sgio2audio_pcm_pointer, - .page = snd_sgio2audio_page, + .page = snd_pcm_lib_get_vmalloc_page, }; /*