Commit ef1545b8 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: dummy: Use managed buffer allocation

Clean up the driver with the new managed buffer allocation API.
The hw_free callback became superfluous and got dropped.

Link: https://lore.kernel.org/r/20191209094943.14984-6-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 39729889
...@@ -529,15 +529,7 @@ static int dummy_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -529,15 +529,7 @@ static int dummy_pcm_hw_params(struct snd_pcm_substream *substream,
substream->runtime->dma_bytes = params_buffer_bytes(hw_params); substream->runtime->dma_bytes = params_buffer_bytes(hw_params);
return 0; return 0;
} }
return snd_pcm_lib_malloc_pages(substream,
params_buffer_bytes(hw_params));
}
static int dummy_pcm_hw_free(struct snd_pcm_substream *substream)
{
if (fake_buffer)
return 0; return 0;
return snd_pcm_lib_free_pages(substream);
} }
static int dummy_pcm_open(struct snd_pcm_substream *substream) static int dummy_pcm_open(struct snd_pcm_substream *substream)
...@@ -657,7 +649,6 @@ static struct snd_pcm_ops dummy_pcm_ops = { ...@@ -657,7 +649,6 @@ static struct snd_pcm_ops dummy_pcm_ops = {
.close = dummy_pcm_close, .close = dummy_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = dummy_pcm_hw_params, .hw_params = dummy_pcm_hw_params,
.hw_free = dummy_pcm_hw_free,
.prepare = dummy_pcm_prepare, .prepare = dummy_pcm_prepare,
.trigger = dummy_pcm_trigger, .trigger = dummy_pcm_trigger,
.pointer = dummy_pcm_pointer, .pointer = dummy_pcm_pointer,
...@@ -668,7 +659,6 @@ static struct snd_pcm_ops dummy_pcm_ops_no_buf = { ...@@ -668,7 +659,6 @@ static struct snd_pcm_ops dummy_pcm_ops_no_buf = {
.close = dummy_pcm_close, .close = dummy_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = dummy_pcm_hw_params, .hw_params = dummy_pcm_hw_params,
.hw_free = dummy_pcm_hw_free,
.prepare = dummy_pcm_prepare, .prepare = dummy_pcm_prepare,
.trigger = dummy_pcm_trigger, .trigger = dummy_pcm_trigger,
.pointer = dummy_pcm_pointer, .pointer = dummy_pcm_pointer,
...@@ -700,7 +690,7 @@ static int snd_card_dummy_pcm(struct snd_dummy *dummy, int device, ...@@ -700,7 +690,7 @@ static int snd_card_dummy_pcm(struct snd_dummy *dummy, int device,
pcm->info_flags = 0; pcm->info_flags = 0;
strcpy(pcm->name, "Dummy PCM"); strcpy(pcm->name, "Dummy PCM");
if (!fake_buffer) { if (!fake_buffer) {
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,
0, 64*1024); 0, 64*1024);
......
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