ALSA: ua101: 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. (*) 1fe7f397cfe2: ALSA: memalloc: Add vmalloc buffer allocation support 7e8edae39fd1: ALSA: pcm: Handle special page mapping in the default mmap handler Link: https://lore.kernel.org/r/20191105151856.10785-15-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
d7867ee7d2
commit
95ef15c65a
@ -733,8 +733,8 @@ static int capture_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
return snd_pcm_lib_alloc_vmalloc_buffer(substream,
|
return snd_pcm_lib_malloc_pages(substream,
|
||||||
params_buffer_bytes(hw_params));
|
params_buffer_bytes(hw_params));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int playback_pcm_hw_params(struct snd_pcm_substream *substream,
|
static int playback_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||||
@ -751,13 +751,13 @@ static int playback_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
return snd_pcm_lib_alloc_vmalloc_buffer(substream,
|
return snd_pcm_lib_malloc_pages(substream,
|
||||||
params_buffer_bytes(hw_params));
|
params_buffer_bytes(hw_params));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ua101_pcm_hw_free(struct snd_pcm_substream *substream)
|
static int ua101_pcm_hw_free(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
return snd_pcm_lib_free_vmalloc_buffer(substream);
|
return snd_pcm_lib_free_pages(substream);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int capture_pcm_prepare(struct snd_pcm_substream *substream)
|
static int capture_pcm_prepare(struct snd_pcm_substream *substream)
|
||||||
@ -889,7 +889,6 @@ static const struct snd_pcm_ops capture_pcm_ops = {
|
|||||||
.prepare = capture_pcm_prepare,
|
.prepare = capture_pcm_prepare,
|
||||||
.trigger = capture_pcm_trigger,
|
.trigger = capture_pcm_trigger,
|
||||||
.pointer = capture_pcm_pointer,
|
.pointer = capture_pcm_pointer,
|
||||||
.page = snd_pcm_lib_get_vmalloc_page,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct snd_pcm_ops playback_pcm_ops = {
|
static const struct snd_pcm_ops playback_pcm_ops = {
|
||||||
@ -901,7 +900,6 @@ static const struct snd_pcm_ops playback_pcm_ops = {
|
|||||||
.prepare = playback_pcm_prepare,
|
.prepare = playback_pcm_prepare,
|
||||||
.trigger = playback_pcm_trigger,
|
.trigger = playback_pcm_trigger,
|
||||||
.pointer = playback_pcm_pointer,
|
.pointer = playback_pcm_pointer,
|
||||||
.page = snd_pcm_lib_get_vmalloc_page,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct uac_format_type_i_discrete_descriptor *
|
static const struct uac_format_type_i_discrete_descriptor *
|
||||||
@ -1296,6 +1294,8 @@ static int ua101_probe(struct usb_interface *interface,
|
|||||||
strcpy(ua->pcm->name, name);
|
strcpy(ua->pcm->name, name);
|
||||||
snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops);
|
snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops);
|
||||||
snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops);
|
snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops);
|
||||||
|
snd_pcm_lib_preallocate_pages_for_all(ua->pcm, SNDRV_DMA_TYPE_VMALLOC,
|
||||||
|
NULL, 0, 0);
|
||||||
|
|
||||||
err = snd_usbmidi_create(card, ua->intf[INTF_MIDI],
|
err = snd_usbmidi_create(card, ua->intf[INTF_MIDI],
|
||||||
&ua->midi_list, &midi_quirk);
|
&ua->midi_list, &midi_quirk);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user