ALSA: aloop: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The hw_params callback became superfluous and got dropped. Link: https://lore.kernel.org/r/20191209094943.14984-5-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Родитель
37b9b9a507
Коммит
39729889b1
|
@ -905,12 +905,6 @@ static void loopback_runtime_free(struct snd_pcm_runtime *runtime)
|
|||
kfree(dpcm);
|
||||
}
|
||||
|
||||
static int loopback_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
|
||||
}
|
||||
|
||||
static int loopback_hw_free(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
|
@ -920,7 +914,7 @@ static int loopback_hw_free(struct snd_pcm_substream *substream)
|
|||
mutex_lock(&dpcm->loopback->cable_lock);
|
||||
cable->valid &= ~(1 << substream->stream);
|
||||
mutex_unlock(&dpcm->loopback->cable_lock);
|
||||
return snd_pcm_lib_free_pages(substream);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned int get_cable_index(struct snd_pcm_substream *substream)
|
||||
|
@ -1306,7 +1300,6 @@ static const struct snd_pcm_ops loopback_pcm_ops = {
|
|||
.open = loopback_open,
|
||||
.close = loopback_close,
|
||||
.ioctl = snd_pcm_lib_ioctl,
|
||||
.hw_params = loopback_hw_params,
|
||||
.hw_free = loopback_hw_free,
|
||||
.prepare = loopback_prepare,
|
||||
.trigger = loopback_trigger,
|
||||
|
@ -1325,8 +1318,7 @@ static int loopback_pcm_new(struct loopback *loopback,
|
|||
return err;
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &loopback_pcm_ops);
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &loopback_pcm_ops);
|
||||
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_VMALLOC,
|
||||
NULL, 0, 0);
|
||||
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0);
|
||||
|
||||
pcm->private_data = loopback;
|
||||
pcm->info_flags = 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче