mirror of https://gitee.com/openkylin/linux.git
ALSA: hiface: 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 Link: https://lore.kernel.org/r/20191105151856.10785-14-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
c7b03852e7
commit
d7867ee7d2
|
@ -418,13 +418,13 @@ static int hiface_pcm_close(struct snd_pcm_substream *alsa_sub)
|
||||||
static int hiface_pcm_hw_params(struct snd_pcm_substream *alsa_sub,
|
static int hiface_pcm_hw_params(struct snd_pcm_substream *alsa_sub,
|
||||||
struct snd_pcm_hw_params *hw_params)
|
struct snd_pcm_hw_params *hw_params)
|
||||||
{
|
{
|
||||||
return snd_pcm_lib_alloc_vmalloc_buffer(alsa_sub,
|
return snd_pcm_lib_malloc_pages(alsa_sub,
|
||||||
params_buffer_bytes(hw_params));
|
params_buffer_bytes(hw_params));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hiface_pcm_hw_free(struct snd_pcm_substream *alsa_sub)
|
static int hiface_pcm_hw_free(struct snd_pcm_substream *alsa_sub)
|
||||||
{
|
{
|
||||||
return snd_pcm_lib_free_vmalloc_buffer(alsa_sub);
|
return snd_pcm_lib_free_pages(alsa_sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hiface_pcm_prepare(struct snd_pcm_substream *alsa_sub)
|
static int hiface_pcm_prepare(struct snd_pcm_substream *alsa_sub)
|
||||||
|
@ -518,7 +518,6 @@ static const struct snd_pcm_ops pcm_ops = {
|
||||||
.prepare = hiface_pcm_prepare,
|
.prepare = hiface_pcm_prepare,
|
||||||
.trigger = hiface_pcm_trigger,
|
.trigger = hiface_pcm_trigger,
|
||||||
.pointer = hiface_pcm_pointer,
|
.pointer = hiface_pcm_pointer,
|
||||||
.page = snd_pcm_lib_get_vmalloc_page,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int hiface_pcm_init_urb(struct pcm_urb *urb,
|
static int hiface_pcm_init_urb(struct pcm_urb *urb,
|
||||||
|
@ -614,6 +613,8 @@ int hiface_pcm_init(struct hiface_chip *chip, u8 extra_freq)
|
||||||
|
|
||||||
strlcpy(pcm->name, "USB-SPDIF Audio", sizeof(pcm->name));
|
strlcpy(pcm->name, "USB-SPDIF Audio", sizeof(pcm->name));
|
||||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &pcm_ops);
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &pcm_ops);
|
||||||
|
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_VMALLOC,
|
||||||
|
NULL, 0, 0);
|
||||||
|
|
||||||
rt->instance = pcm;
|
rt->instance = pcm;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue