Commit 403d026c authored by Takashi Iwai's avatar Takashi Iwai

ALSA: aica: 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-61-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 377d870e
...@@ -363,23 +363,6 @@ static int snd_aicapcm_pcm_close(struct snd_pcm_substream ...@@ -363,23 +363,6 @@ static int snd_aicapcm_pcm_close(struct snd_pcm_substream
return 0; return 0;
} }
static int snd_aicapcm_pcm_hw_free(struct snd_pcm_substream
*substream)
{
/* Free the DMA buffer */
return snd_pcm_lib_free_pages(substream);
}
static int snd_aicapcm_pcm_hw_params(struct snd_pcm_substream
*substream, struct snd_pcm_hw_params
*hw_params)
{
/* Allocate a DMA buffer using ALSA built-ins */
return
snd_pcm_lib_malloc_pages(substream,
params_buffer_bytes(hw_params));
}
static int snd_aicapcm_pcm_prepare(struct snd_pcm_substream static int snd_aicapcm_pcm_prepare(struct snd_pcm_substream
*substream) *substream)
{ {
...@@ -417,8 +400,6 @@ static const struct snd_pcm_ops snd_aicapcm_playback_ops = { ...@@ -417,8 +400,6 @@ static const struct snd_pcm_ops snd_aicapcm_playback_ops = {
.open = snd_aicapcm_pcm_open, .open = snd_aicapcm_pcm_open,
.close = snd_aicapcm_pcm_close, .close = snd_aicapcm_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_aicapcm_pcm_hw_params,
.hw_free = snd_aicapcm_pcm_hw_free,
.prepare = snd_aicapcm_pcm_prepare, .prepare = snd_aicapcm_pcm_prepare,
.trigger = snd_aicapcm_pcm_trigger, .trigger = snd_aicapcm_pcm_trigger,
.pointer = snd_aicapcm_pcm_pointer, .pointer = snd_aicapcm_pcm_pointer,
...@@ -441,11 +422,11 @@ static int __init snd_aicapcmchip(struct snd_card_aica ...@@ -441,11 +422,11 @@ static int __init snd_aicapcmchip(struct snd_card_aica
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
&snd_aicapcm_playback_ops); &snd_aicapcm_playback_ops);
/* Allocate the DMA buffers */ /* Allocate the DMA buffers */
snd_pcm_lib_preallocate_pages_for_all(pcm, snd_pcm_set_managed_buffer_all(pcm,
SNDRV_DMA_TYPE_CONTINUOUS, SNDRV_DMA_TYPE_CONTINUOUS,
NULL, NULL,
AICA_BUFFER_SIZE, AICA_BUFFER_SIZE,
AICA_BUFFER_SIZE); AICA_BUFFER_SIZE);
return 0; return 0;
} }
......
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