Commit 50cdf3a0 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: sh: 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-62-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 403d026c
...@@ -125,18 +125,6 @@ static int snd_sh_dac_pcm_close(struct snd_pcm_substream *substream) ...@@ -125,18 +125,6 @@ static int snd_sh_dac_pcm_close(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static int snd_sh_dac_pcm_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_sh_dac_pcm_hw_free(struct snd_pcm_substream *substream)
{
return snd_pcm_lib_free_pages(substream);
}
static int snd_sh_dac_pcm_prepare(struct snd_pcm_substream *substream) static int snd_sh_dac_pcm_prepare(struct snd_pcm_substream *substream)
{ {
struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
...@@ -241,8 +229,6 @@ static const struct snd_pcm_ops snd_sh_dac_pcm_ops = { ...@@ -241,8 +229,6 @@ static const struct snd_pcm_ops snd_sh_dac_pcm_ops = {
.open = snd_sh_dac_pcm_open, .open = snd_sh_dac_pcm_open,
.close = snd_sh_dac_pcm_close, .close = snd_sh_dac_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_sh_dac_pcm_hw_params,
.hw_free = snd_sh_dac_pcm_hw_free,
.prepare = snd_sh_dac_pcm_prepare, .prepare = snd_sh_dac_pcm_prepare,
.trigger = snd_sh_dac_pcm_trigger, .trigger = snd_sh_dac_pcm_trigger,
.pointer = snd_sh_dac_pcm_pointer, .pointer = snd_sh_dac_pcm_pointer,
...@@ -267,10 +253,8 @@ static int snd_sh_dac_pcm(struct snd_sh_dac *chip, int device) ...@@ -267,10 +253,8 @@ static int snd_sh_dac_pcm(struct snd_sh_dac *chip, int device)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sh_dac_pcm_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sh_dac_pcm_ops);
/* buffer size=48K */ /* buffer size=48K */
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
NULL, NULL, 48 * 1024, 48 * 1024);
48 * 1024,
48 * 1024);
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