Skip to content

Commit b29e5ef

Browse files
committed
ALSA: aloop: Convert to the common vmalloc memalloc
The recent change (*) in the ALSA memalloc core allows us to drop the special vmalloc-specific allocation and page handling. This patch coverts to the common code. (*) 1fe7f39: ALSA: memalloc: Add vmalloc buffer allocation support 7e8edae: ALSA: pcm: Handle special page mapping in the default mmap handler Link: https://lore.kernel.org/r/20191105151856.10785-10-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent b315997 commit b29e5ef

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎sound/drivers/aloop.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,7 @@ static void loopback_runtime_free(struct snd_pcm_runtime *runtime)
576576
static int loopback_hw_params(struct snd_pcm_substream *substream,
577577
struct snd_pcm_hw_params *params)
578578
{
579-
return snd_pcm_lib_alloc_vmalloc_buffer(substream,
580-
params_buffer_bytes(params));
579+
return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
581580
}
582581

583582
static int loopback_hw_free(struct snd_pcm_substream *substream)
@@ -589,7 +588,7 @@ static int loopback_hw_free(struct snd_pcm_substream *substream)
589588
mutex_lock(&dpcm->loopback->cable_lock);
590589
cable->valid &= ~(1 << substream->stream);
591590
mutex_unlock(&dpcm->loopback->cable_lock);
592-
return snd_pcm_lib_free_vmalloc_buffer(substream);
591+
return snd_pcm_lib_free_pages(substream);
593592
}
594593

595594
static unsigned int get_cable_index(struct snd_pcm_substream *substream)
@@ -765,7 +764,6 @@ static const struct snd_pcm_ops loopback_pcm_ops = {
765764
.prepare = loopback_prepare,
766765
.trigger = loopback_trigger,
767766
.pointer = loopback_pointer,
768-
.page = snd_pcm_lib_get_vmalloc_page,
769767
};
770768

771769
static int loopback_pcm_new(struct loopback *loopback,
@@ -780,6 +778,8 @@ static int loopback_pcm_new(struct loopback *loopback,
780778
return err;
781779
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &loopback_pcm_ops);
782780
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &loopback_pcm_ops);
781+
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_VMALLOC,
782+
NULL, 0, 0);
783783

784784
pcm->private_data = loopback;
785785
pcm->info_flags = 0;

0 commit comments

Comments
 (0)