From c6071300ac85b0db5cce715fa5bc3727251fb65a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:49:04 +0100 Subject: ALSA: cs5535: Use managed buffer allocation Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped. Link: https://lore.kernel.org/r/20191209094943.14984-33-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/pci/cs5535audio/cs5535audio_pcm.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'sound/pci/cs5535audio/cs5535audio_pcm.c') diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c index 4642e5384e83..0b2a23c6d277 100644 --- a/sound/pci/cs5535audio/cs5535audio_pcm.c +++ b/sound/pci/cs5535audio/cs5535audio_pcm.c @@ -236,10 +236,6 @@ static int snd_cs5535audio_hw_params(struct snd_pcm_substream *substream, struct cs5535audio_dma *dma = substream->runtime->private_data; int err; - err = snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); - if (err < 0) - return err; dma->buf_addr = substream->runtime->dma_addr; dma->buf_bytes = params_buffer_bytes(hw_params); @@ -267,7 +263,7 @@ static int snd_cs5535audio_hw_free(struct snd_pcm_substream *substream) dma->pcm_open_flag = 0; } cs5535audio_clear_dma_packets(cs5535au, dma, substream); - return snd_pcm_lib_free_pages(substream); + return 0; } static int snd_cs5535audio_playback_prepare(struct snd_pcm_substream *substream) @@ -431,9 +427,9 @@ int snd_cs5535audio_pcm(struct cs5535audio *cs5535au) pcm->info_flags = 0; strcpy(pcm->name, "CS5535 Audio"); - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - &cs5535au->pci->dev, - 64*1024, 128*1024); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, + &cs5535au->pci->dev, + 64*1024, 128*1024); cs5535au->pcm = pcm; return 0; -- cgit v1.2.3-59-g8ed1b