From cc6c69126e38d3880b72400cfe29e52cc1a7fa2b Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:49:43 +0100 Subject: ALSA: hdml-lpe-audio: 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-72-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/x86/intel_hdmi_audio.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'sound/x86') diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c index cd389d21219a..a67692ca08af 100644 --- a/sound/x86/intel_hdmi_audio.c +++ b/sound/x86/intel_hdmi_audio.c @@ -1132,16 +1132,13 @@ static int had_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) { struct snd_intelhad *intelhaddata; - int buf_size, retval; + int buf_size; intelhaddata = snd_pcm_substream_chip(substream); buf_size = params_buffer_bytes(hw_params); - retval = snd_pcm_lib_malloc_pages(substream, buf_size); - if (retval < 0) - return retval; dev_dbg(intelhaddata->dev, "%s:allocated memory = %d\n", __func__, buf_size); - return retval; + return 0; } /* @@ -1154,7 +1151,7 @@ static int had_pcm_hw_free(struct snd_pcm_substream *substream) intelhaddata = snd_pcm_substream_chip(substream); had_do_reset(intelhaddata); - return snd_pcm_lib_free_pages(substream); + return 0; } /* @@ -1801,10 +1798,9 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev) /* allocate dma pages; * try to allocate 600k buffer as default which is large enough */ - snd_pcm_lib_preallocate_pages_for_all(pcm, - SNDRV_DMA_TYPE_DEV_UC, - card->dev, - HAD_DEFAULT_BUFFER, HAD_MAX_BUFFER); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV_UC, + card->dev, HAD_DEFAULT_BUFFER, + HAD_MAX_BUFFER); /* create controls */ for (i = 0; i < ARRAY_SIZE(had_controls); i++) { -- cgit v1.2.3-59-g8ed1b From 63d5cda7f55bb3537d30642c1cf7e5afccb6e6c7 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:11:44 +0100 Subject: ALSA: x86: Drop superfluous ioctl PCM ops PCM core deals the empty ioctl field now as default(*). Let's kill the redundant lines. (*) commit fc033cbf6fb7 ("ALSA: pcm: Allow NULL ioctl ops") Link: https://lore.kernel.org/r/20191210061145.24641-23-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/x86/intel_hdmi_audio.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound/x86') diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c index a67692ca08af..741cf611ea30 100644 --- a/sound/x86/intel_hdmi_audio.c +++ b/sound/x86/intel_hdmi_audio.c @@ -1286,7 +1286,6 @@ static int had_pcm_mmap(struct snd_pcm_substream *substream, static const struct snd_pcm_ops had_pcm_ops = { .open = had_pcm_open, .close = had_pcm_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = had_pcm_hw_params, .hw_free = had_pcm_hw_free, .prepare = had_pcm_prepare, -- cgit v1.2.3-59-g8ed1b