From 005f3e67a855f6d1deaea84e0ab8e40c597ad10c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:48:50 +0100 Subject: ALSA: parisc: Use managed buffer allocation Clean up the driver with the new managed buffer allocation API. The hw_free callbacks became superfluous and got dropped. Link: https://lore.kernel.org/r/20191209094943.14984-19-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/parisc/harmony.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'sound/parisc') diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index 6acc59c25379..1a4c40aafcbe 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c @@ -567,20 +567,12 @@ static int snd_harmony_hw_params(struct snd_pcm_substream *ss, struct snd_pcm_hw_params *hw) { - int err; struct snd_harmony *h = snd_pcm_substream_chip(ss); - err = snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(hw)); - if (err > 0 && h->dma.type == SNDRV_DMA_TYPE_CONTINUOUS) + if (h->dma.type == SNDRV_DMA_TYPE_CONTINUOUS) ss->runtime->dma_addr = __pa(ss->runtime->dma_area); - - return err; -} -static int -snd_harmony_hw_free(struct snd_pcm_substream *ss) -{ - return snd_pcm_lib_free_pages(ss); + return 0; } static const struct snd_pcm_ops snd_harmony_playback_ops = { @@ -588,7 +580,6 @@ static const struct snd_pcm_ops snd_harmony_playback_ops = { .close = snd_harmony_playback_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_harmony_hw_params, - .hw_free = snd_harmony_hw_free, .prepare = snd_harmony_playback_prepare, .trigger = snd_harmony_playback_trigger, .pointer = snd_harmony_playback_pointer, @@ -599,7 +590,6 @@ static const struct snd_pcm_ops snd_harmony_capture_ops = { .close = snd_harmony_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_harmony_hw_params, - .hw_free = snd_harmony_hw_free, .prepare = snd_harmony_capture_prepare, .trigger = snd_harmony_capture_trigger, .pointer = snd_harmony_capture_pointer, @@ -656,8 +646,8 @@ snd_harmony_pcm_init(struct snd_harmony *h) } /* pre-allocate space for DMA */ - snd_pcm_lib_preallocate_pages_for_all(pcm, h->dma.type, h->dma.dev, - MAX_BUF_SIZE, MAX_BUF_SIZE); + snd_pcm_set_managed_buffer_all(pcm, h->dma.type, h->dma.dev, + MAX_BUF_SIZE, MAX_BUF_SIZE); h->st.format = snd_harmony_set_data_format(h, SNDRV_PCM_FORMAT_S16_BE, 1); -- cgit