aboutsummaryrefslogtreecommitdiffstats
path: root/sound/mips
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2009-12-18 03:30:24 -0500
committerTakashi Iwai <tiwai@suse.de>2009-12-18 06:57:13 -0500
commit6cedf8696d6a01bba391bdae06231243cfe2f48a (patch)
treeed2ddf4bd730e5a12b16912c5b1fd8884a92fc22 /sound/mips
parentd20fb5dc076a4cf0fdd00ab5a4e752ea3611e484 (diff)
sound: sgio2audio: 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/mips')
-rw-r--r--sound/mips/sgio2audio.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c
index f1d9d16b5486..9b486beeb932 100644
--- a/sound/mips/sgio2audio.c
+++ b/sound/mips/sgio2audio.c
@@ -26,7 +26,6 @@
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/gfp.h> 28#include <linux/gfp.h>
29#include <linux/vmalloc.h>
30#include <linux/interrupt.h> 29#include <linux/interrupt.h>
31#include <linux/dma-mapping.h> 30#include <linux/dma-mapping.h>
32#include <linux/platform_device.h> 31#include <linux/platform_device.h>
@@ -603,25 +602,14 @@ static int snd_sgio2audio_pcm_close(struct snd_pcm_substream *substream)
603static int snd_sgio2audio_pcm_hw_params(struct snd_pcm_substream *substream, 602static int snd_sgio2audio_pcm_hw_params(struct snd_pcm_substream *substream,
604 struct snd_pcm_hw_params *hw_params) 603 struct snd_pcm_hw_params *hw_params)
605{ 604{
606 struct snd_pcm_runtime *runtime = substream->runtime; 605 return snd_pcm_lib_alloc_vmalloc_buffer(substream,
607 int size = params_buffer_bytes(hw_params); 606 params_buffer_bytes(hw_params));
608
609 /* alloc virtual 'dma' area */
610 if (runtime->dma_area)
611 vfree(runtime->dma_area);
612 runtime->dma_area = vmalloc_user(size);
613 if (runtime->dma_area == NULL)
614 return -ENOMEM;
615 runtime->dma_bytes = size;
616 return 0;
617} 607}
618 608
619/* hw_free callback */ 609/* hw_free callback */
620static int snd_sgio2audio_pcm_hw_free(struct snd_pcm_substream *substream) 610static int snd_sgio2audio_pcm_hw_free(struct snd_pcm_substream *substream)
621{ 611{
622 vfree(substream->runtime->dma_area); 612 return snd_pcm_lib_free_vmalloc_buffer(substream);
623 substream->runtime->dma_area = NULL;
624 return 0;
625} 613}
626 614
627/* prepare callback */ 615/* prepare callback */
@@ -692,13 +680,6 @@ snd_sgio2audio_pcm_pointer(struct snd_pcm_substream *substream)
692 chip->channel[chan->idx].pos); 680 chip->channel[chan->idx].pos);
693} 681}
694 682
695/* get the physical page pointer on the given offset */
696static struct page *snd_sgio2audio_page(struct snd_pcm_substream *substream,
697 unsigned long offset)
698{
699 return vmalloc_to_page(substream->runtime->dma_area + offset);
700}
701
702/* operators */ 683/* operators */
703static struct snd_pcm_ops snd_sgio2audio_playback1_ops = { 684static struct snd_pcm_ops snd_sgio2audio_playback1_ops = {
704 .open = snd_sgio2audio_playback1_open, 685 .open = snd_sgio2audio_playback1_open,
@@ -709,7 +690,7 @@ static struct snd_pcm_ops snd_sgio2audio_playback1_ops = {
709 .prepare = snd_sgio2audio_pcm_prepare, 690 .prepare = snd_sgio2audio_pcm_prepare,
710 .trigger = snd_sgio2audio_pcm_trigger, 691 .trigger = snd_sgio2audio_pcm_trigger,
711 .pointer = snd_sgio2audio_pcm_pointer, 692 .pointer = snd_sgio2audio_pcm_pointer,
712 .page = snd_sgio2audio_page, 693 .page = snd_pcm_lib_get_vmalloc_page,
713}; 694};
714 695
715static struct snd_pcm_ops snd_sgio2audio_playback2_ops = { 696static struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
@@ -721,7 +702,7 @@ static struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
721 .prepare = snd_sgio2audio_pcm_prepare, 702 .prepare = snd_sgio2audio_pcm_prepare,
722 .trigger = snd_sgio2audio_pcm_trigger, 703 .trigger = snd_sgio2audio_pcm_trigger,
723 .pointer = snd_sgio2audio_pcm_pointer, 704 .pointer = snd_sgio2audio_pcm_pointer,
724 .page = snd_sgio2audio_page, 705 .page = snd_pcm_lib_get_vmalloc_page,
725}; 706};
726 707
727static struct snd_pcm_ops snd_sgio2audio_capture_ops = { 708static struct snd_pcm_ops snd_sgio2audio_capture_ops = {
@@ -733,7 +714,7 @@ static struct snd_pcm_ops snd_sgio2audio_capture_ops = {
733 .prepare = snd_sgio2audio_pcm_prepare, 714 .prepare = snd_sgio2audio_pcm_prepare,
734 .trigger = snd_sgio2audio_pcm_trigger, 715 .trigger = snd_sgio2audio_pcm_trigger,
735 .pointer = snd_sgio2audio_pcm_pointer, 716 .pointer = snd_sgio2audio_pcm_pointer,
736 .page = snd_sgio2audio_page, 717 .page = snd_pcm_lib_get_vmalloc_page,
737}; 718};
738 719
739/* 720/*