Commit 748a76b2 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: vx: 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.
(*) 1fe7f397: ALSA: memalloc: Add vmalloc buffer allocation
                  support
    7e8edae3: 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-16-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 95ef15c6
...@@ -778,8 +778,7 @@ static snd_pcm_uframes_t vx_pcm_playback_pointer(struct snd_pcm_substream *subs) ...@@ -778,8 +778,7 @@ static snd_pcm_uframes_t vx_pcm_playback_pointer(struct snd_pcm_substream *subs)
static int vx_pcm_hw_params(struct snd_pcm_substream *subs, static int vx_pcm_hw_params(struct snd_pcm_substream *subs,
struct snd_pcm_hw_params *hw_params) struct snd_pcm_hw_params *hw_params)
{ {
return snd_pcm_lib_alloc_vmalloc_32_buffer return snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw_params));
(subs, params_buffer_bytes(hw_params));
} }
/* /*
...@@ -787,7 +786,7 @@ static int vx_pcm_hw_params(struct snd_pcm_substream *subs, ...@@ -787,7 +786,7 @@ static int vx_pcm_hw_params(struct snd_pcm_substream *subs,
*/ */
static int vx_pcm_hw_free(struct snd_pcm_substream *subs) static int vx_pcm_hw_free(struct snd_pcm_substream *subs)
{ {
return snd_pcm_lib_free_vmalloc_buffer(subs); return snd_pcm_lib_free_pages(subs);
} }
/* /*
...@@ -867,7 +866,6 @@ static const struct snd_pcm_ops vx_pcm_playback_ops = { ...@@ -867,7 +866,6 @@ static const struct snd_pcm_ops vx_pcm_playback_ops = {
.prepare = vx_pcm_prepare, .prepare = vx_pcm_prepare,
.trigger = vx_pcm_trigger, .trigger = vx_pcm_trigger,
.pointer = vx_pcm_playback_pointer, .pointer = vx_pcm_playback_pointer,
.page = snd_pcm_lib_get_vmalloc_page,
}; };
...@@ -1088,7 +1086,6 @@ static const struct snd_pcm_ops vx_pcm_capture_ops = { ...@@ -1088,7 +1086,6 @@ static const struct snd_pcm_ops vx_pcm_capture_ops = {
.prepare = vx_pcm_prepare, .prepare = vx_pcm_prepare,
.trigger = vx_pcm_trigger, .trigger = vx_pcm_trigger,
.pointer = vx_pcm_capture_pointer, .pointer = vx_pcm_capture_pointer,
.page = snd_pcm_lib_get_vmalloc_page,
}; };
...@@ -1233,6 +1230,9 @@ int snd_vx_pcm_new(struct vx_core *chip) ...@@ -1233,6 +1230,9 @@ int snd_vx_pcm_new(struct vx_core *chip)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &vx_pcm_playback_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &vx_pcm_playback_ops);
if (ins) if (ins)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &vx_pcm_capture_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &vx_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->private_data = chip;
pcm->private_free = snd_vx_pcm_free; pcm->private_free = snd_vx_pcm_free;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment