From 44e78a1a85ad5b893dda6cbf866e9e14acf71e0d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:49:03 +0100 Subject: ALSA: cs4281: Use managed buffer allocation Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped. Link: https://lore.kernel.org/r/20191209094943.14984-32-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/pci/cs4281.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'sound/pci/cs4281.c') diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 058c1414b777..ea665d42107e 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -780,17 +780,6 @@ static void snd_cs4281_mode(struct cs4281 *chip, struct cs4281_dma *dma, snd_cs4281_pokeBA0(chip, dma->regFSIC, 0); } -static int snd_cs4281_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *hw_params) -{ - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); -} - -static int snd_cs4281_hw_free(struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int snd_cs4281_playback_prepare(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; @@ -939,8 +928,6 @@ static const struct snd_pcm_ops snd_cs4281_playback_ops = { .open = snd_cs4281_playback_open, .close = snd_cs4281_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_cs4281_hw_params, - .hw_free = snd_cs4281_hw_free, .prepare = snd_cs4281_playback_prepare, .trigger = snd_cs4281_trigger, .pointer = snd_cs4281_pointer, @@ -950,8 +937,6 @@ static const struct snd_pcm_ops snd_cs4281_capture_ops = { .open = snd_cs4281_capture_open, .close = snd_cs4281_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_cs4281_hw_params, - .hw_free = snd_cs4281_hw_free, .prepare = snd_cs4281_capture_prepare, .trigger = snd_cs4281_trigger, .pointer = snd_cs4281_pointer, @@ -974,9 +959,8 @@ static int snd_cs4281_pcm(struct cs4281 *chip, int device) strcpy(pcm->name, "CS4281"); chip->pcm = pcm; - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - &chip->pci->dev, - 64*1024, 512*1024); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev, + 64*1024, 512*1024); return 0; } -- cgit