summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-11-05 16:18:48 +0100
committerTakashi Iwai <tiwai@suse.de>2019-11-06 15:47:42 +0100
commitd5dec270c00c155db64c3d2151b94002dfb2c6c7 (patch)
treefabc93fd99e0a7cf94d89b6ac2f80cd3552d97e4
parent748a76b215a36e9bb88a5bd8b56c5088371b2f19 (diff)
downloadlinux-d5dec270c00c155db64c3d2151b94002dfb2c6c7.tar.bz2
ALSA: pdaudiocf: Convert to the common vmalloc memalloc
The recent change (*) in the ALSA memalloc core allows us to drop the special vmalloc-specific allocation and page handling. This patch coverts to the common code. (*) 1fe7f397cfe2: ALSA: memalloc: Add vmalloc buffer allocation support 7e8edae39fd1: ALSA: pcm: Handle special page mapping in the default mmap handler Since the driver requires the DMA32 allocation, it passes the specially encoded device to snd_pcm_lib_preallocate_pages(). Link: https://lore.kernel.org/r/20191105151856.10785-17-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
index c21fec60cd98..067b1c3a3e02 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
@@ -89,8 +89,7 @@ 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_lib_alloc_vmalloc_32_buffer
- (subs, params_buffer_bytes(hw_params));
+ return snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw_params));
}
/*
@@ -98,7 +97,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_lib_free_vmalloc_buffer(subs);
+ return snd_pcm_lib_free_pages(subs);
}
/*
@@ -262,7 +261,6 @@ static const struct snd_pcm_ops pdacf_pcm_capture_ops = {
.prepare = pdacf_pcm_prepare,
.trigger = pdacf_pcm_trigger,
.pointer = pdacf_pcm_capture_pointer,
- .page = snd_pcm_lib_get_vmalloc_page,
};
@@ -279,6 +277,9 @@ int snd_pdacf_pcm_new(struct snd_pdacf *chip)
return err;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pdacf_pcm_capture_ops);
+ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_VMALLOC,
+ snd_dma_continuous_data(GFP_KERNEL | GFP_DMA32),
+ 0, 0);
pcm->private_data = chip;
pcm->info_flags = 0;