Commit ff3eb3d5 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: sis7019: 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-53-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 7ceebdc8
...@@ -499,18 +499,6 @@ static int sis_substream_close(struct snd_pcm_substream *substream) ...@@ -499,18 +499,6 @@ static int sis_substream_close(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static int sis_playback_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 sis_hw_free(struct snd_pcm_substream *substream)
{
return snd_pcm_lib_free_pages(substream);
}
static int sis_pcm_playback_prepare(struct snd_pcm_substream *substream) static int sis_pcm_playback_prepare(struct snd_pcm_substream *substream)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
...@@ -701,11 +689,6 @@ static int sis_capture_hw_params(struct snd_pcm_substream *substream, ...@@ -701,11 +689,6 @@ static int sis_capture_hw_params(struct snd_pcm_substream *substream,
if (rc) if (rc)
goto out; goto out;
rc = snd_pcm_lib_malloc_pages(substream,
params_buffer_bytes(hw_params));
if (rc < 0)
goto out;
rc = sis_alloc_timing_voice(substream, hw_params); rc = sis_alloc_timing_voice(substream, hw_params);
out: out:
...@@ -864,8 +847,6 @@ static const struct snd_pcm_ops sis_playback_ops = { ...@@ -864,8 +847,6 @@ static const struct snd_pcm_ops sis_playback_ops = {
.open = sis_playback_open, .open = sis_playback_open,
.close = sis_substream_close, .close = sis_substream_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = sis_playback_hw_params,
.hw_free = sis_hw_free,
.prepare = sis_pcm_playback_prepare, .prepare = sis_pcm_playback_prepare,
.trigger = sis_pcm_trigger, .trigger = sis_pcm_trigger,
.pointer = sis_pcm_pointer, .pointer = sis_pcm_pointer,
...@@ -876,7 +857,6 @@ static const struct snd_pcm_ops sis_capture_ops = { ...@@ -876,7 +857,6 @@ static const struct snd_pcm_ops sis_capture_ops = {
.close = sis_substream_close, .close = sis_substream_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = sis_capture_hw_params, .hw_params = sis_capture_hw_params,
.hw_free = sis_hw_free,
.prepare = sis_pcm_capture_prepare, .prepare = sis_pcm_capture_prepare,
.trigger = sis_pcm_trigger, .trigger = sis_pcm_trigger,
.pointer = sis_pcm_pointer, .pointer = sis_pcm_pointer,
...@@ -904,9 +884,8 @@ static int sis_pcm_create(struct sis7019 *sis) ...@@ -904,9 +884,8 @@ static int sis_pcm_create(struct sis7019 *sis)
/* Try to preallocate some memory, but it's not the end of the /* Try to preallocate some memory, but it's not the end of the
* world if this fails. * world if this fails.
*/ */
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&sis->pci->dev, &sis->pci->dev, 64*1024, 128*1024);
64*1024, 128*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