Commit cc6c6912 authored by Takashi Iwai's avatar Takashi Iwai

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.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent dd21bf51
...@@ -1132,16 +1132,13 @@ static int had_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -1132,16 +1132,13 @@ static int had_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params) struct snd_pcm_hw_params *hw_params)
{ {
struct snd_intelhad *intelhaddata; struct snd_intelhad *intelhaddata;
int buf_size, retval; int buf_size;
intelhaddata = snd_pcm_substream_chip(substream); intelhaddata = snd_pcm_substream_chip(substream);
buf_size = params_buffer_bytes(hw_params); 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", dev_dbg(intelhaddata->dev, "%s:allocated memory = %d\n",
__func__, buf_size); __func__, buf_size);
return retval; return 0;
} }
/* /*
...@@ -1154,7 +1151,7 @@ static int had_pcm_hw_free(struct snd_pcm_substream *substream) ...@@ -1154,7 +1151,7 @@ static int had_pcm_hw_free(struct snd_pcm_substream *substream)
intelhaddata = snd_pcm_substream_chip(substream); intelhaddata = snd_pcm_substream_chip(substream);
had_do_reset(intelhaddata); 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) ...@@ -1801,10 +1798,9 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
/* allocate dma pages; /* allocate dma pages;
* try to allocate 600k buffer as default which is large enough * try to allocate 600k buffer as default which is large enough
*/ */
snd_pcm_lib_preallocate_pages_for_all(pcm, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV_UC,
SNDRV_DMA_TYPE_DEV_UC, card->dev, HAD_DEFAULT_BUFFER,
card->dev, HAD_MAX_BUFFER);
HAD_DEFAULT_BUFFER, HAD_MAX_BUFFER);
/* create controls */ /* create controls */
for (i = 0; i < ARRAY_SIZE(had_controls); i++) { for (i = 0; i < ARRAY_SIZE(had_controls); i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment