From a747db239010bcabe48e3429556b782988a11797 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:49:17 +0100 Subject: [PATCH] ALSA: lx6464es: 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-46-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/pci/lx6464es/lx6464es.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index d0f63fa54121..a74d8eade3e2 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c @@ -342,23 +342,18 @@ static int lx_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params, int is_capture) { struct lx6464es *chip = snd_pcm_substream_chip(substream); - int err = 0; dev_dbg(chip->card->dev, "->lx_pcm_hw_params\n"); mutex_lock(&chip->setup_mutex); - /* set dma buffer */ - err = snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); - if (is_capture) chip->capture_stream.stream = substream; else chip->playback_stream.stream = substream; mutex_unlock(&chip->setup_mutex); - return err; + return 0; } static int lx_pcm_hw_params_playback(struct snd_pcm_substream *substream, @@ -400,8 +395,6 @@ static int lx_pcm_hw_free(struct snd_pcm_substream *substream) chip->hardware_running[is_capture] = 0; } - err = snd_pcm_lib_free_pages(substream); - if (is_capture) chip->capture_stream.stream = NULL; else @@ -845,9 +838,8 @@ static int lx_pcm_create(struct lx6464es *chip) pcm->nonatomic = true; strcpy(pcm->name, card_name); - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - &chip->pci->dev, - size, size); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, + &chip->pci->dev, size, size); chip->pcm = pcm; chip->capture_stream.is_capture = 1; -- 2.39.5