mirror of https://gitee.com/openkylin/linux.git
staging: most: 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 Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20191108164528.998-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
67b2945d63
commit
9cb7831384
|
@ -344,8 +344,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,
|
||||||
pr_err("Requested number of channels not supported.\n");
|
pr_err("Requested number of channels not supported.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return snd_pcm_lib_alloc_vmalloc_buffer(substream,
|
return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
|
||||||
params_buffer_bytes(hw_params));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -359,7 +358,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,
|
||||||
*/
|
*/
|
||||||
static int pcm_hw_free(struct snd_pcm_substream *substream)
|
static int pcm_hw_free(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
return snd_pcm_lib_free_vmalloc_buffer(substream);
|
return snd_pcm_lib_free_pages(substream);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -469,7 +468,6 @@ static const struct snd_pcm_ops pcm_ops = {
|
||||||
.prepare = pcm_prepare,
|
.prepare = pcm_prepare,
|
||||||
.trigger = pcm_trigger,
|
.trigger = pcm_trigger,
|
||||||
.pointer = pcm_pointer,
|
.pointer = pcm_pointer,
|
||||||
.page = snd_pcm_lib_get_vmalloc_page,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int split_arg_list(char *buf, u16 *ch_num, char **sample_res)
|
static int split_arg_list(char *buf, u16 *ch_num, char **sample_res)
|
||||||
|
@ -663,6 +661,8 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id,
|
||||||
pcm->private_data = channel;
|
pcm->private_data = channel;
|
||||||
strscpy(pcm->name, device_name, sizeof(pcm->name));
|
strscpy(pcm->name, device_name, sizeof(pcm->name));
|
||||||
snd_pcm_set_ops(pcm, direction, &pcm_ops);
|
snd_pcm_set_ops(pcm, direction, &pcm_ops);
|
||||||
|
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_VMALLOC,
|
||||||
|
NULL, 0, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue