Skip to content

Commit 30f2ce7

Browse files
committed
ALSA: mips: 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-18-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent d5dec27 commit 30f2ce7

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎sound/mips/sgio2audio.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -582,14 +582,13 @@ static int snd_sgio2audio_pcm_close(struct snd_pcm_substream *substream)
582582
static int snd_sgio2audio_pcm_hw_params(struct snd_pcm_substream *substream,
583583
struct snd_pcm_hw_params *hw_params)
584584
{
585-
return snd_pcm_lib_alloc_vmalloc_buffer(substream,
586-
params_buffer_bytes(hw_params));
585+
return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
587586
}
588587

589588
/* hw_free callback */
590589
static int snd_sgio2audio_pcm_hw_free(struct snd_pcm_substream *substream)
591590
{
592-
return snd_pcm_lib_free_vmalloc_buffer(substream);
591+
return snd_pcm_lib_free_pages(substream);
593592
}
594593

595594
/* prepare callback */
@@ -670,7 +669,6 @@ static const struct snd_pcm_ops snd_sgio2audio_playback1_ops = {
670669
.prepare = snd_sgio2audio_pcm_prepare,
671670
.trigger = snd_sgio2audio_pcm_trigger,
672671
.pointer = snd_sgio2audio_pcm_pointer,
673-
.page = snd_pcm_lib_get_vmalloc_page,
674672
};
675673

676674
static const struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
@@ -682,7 +680,6 @@ static const struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
682680
.prepare = snd_sgio2audio_pcm_prepare,
683681
.trigger = snd_sgio2audio_pcm_trigger,
684682
.pointer = snd_sgio2audio_pcm_pointer,
685-
.page = snd_pcm_lib_get_vmalloc_page,
686683
};
687684

688685
static const struct snd_pcm_ops snd_sgio2audio_capture_ops = {
@@ -694,7 +691,6 @@ static const struct snd_pcm_ops snd_sgio2audio_capture_ops = {
694691
.prepare = snd_sgio2audio_pcm_prepare,
695692
.trigger = snd_sgio2audio_pcm_trigger,
696693
.pointer = snd_sgio2audio_pcm_pointer,
697-
.page = snd_pcm_lib_get_vmalloc_page,
698694
};
699695

700696
/*
@@ -720,6 +716,8 @@ static int snd_sgio2audio_new_pcm(struct snd_sgio2audio *chip)
720716
&snd_sgio2audio_playback1_ops);
721717
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
722718
&snd_sgio2audio_capture_ops);
719+
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_VMALLOC,
720+
NULL, 0, 0);
723721

724722
/* create second pcm device with one outputs and no input */
725723
err = snd_pcm_new(chip->card, "SGI O2 Audio", 1, 1, 0, &pcm);
@@ -732,6 +730,8 @@ static int snd_sgio2audio_new_pcm(struct snd_sgio2audio *chip)
732730
/* set operators */
733731
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
734732
&snd_sgio2audio_playback2_ops);
733+
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_VMALLOC,
734+
NULL, 0, 0);
735735

736736
return 0;
737737
}

0 commit comments

Comments
 (0)