2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-28 15:13:55 +08:00

ALSA: ua101: 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-69-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2019-12-09 10:49:40 +01:00
parent b9626bd623
commit 8aa77f9cab

View File

@ -730,11 +730,7 @@ static int capture_pcm_hw_params(struct snd_pcm_substream *substream,
mutex_lock(&ua->mutex);
err = start_usb_capture(ua);
mutex_unlock(&ua->mutex);
if (err < 0)
return err;
return snd_pcm_lib_malloc_pages(substream,
params_buffer_bytes(hw_params));
return err;
}
static int playback_pcm_hw_params(struct snd_pcm_substream *substream,
@ -748,16 +744,7 @@ static int playback_pcm_hw_params(struct snd_pcm_substream *substream,
if (err >= 0)
err = start_usb_playback(ua);
mutex_unlock(&ua->mutex);
if (err < 0)
return err;
return snd_pcm_lib_malloc_pages(substream,
params_buffer_bytes(hw_params));
}
static int ua101_pcm_hw_free(struct snd_pcm_substream *substream)
{
return snd_pcm_lib_free_pages(substream);
return err;
}
static int capture_pcm_prepare(struct snd_pcm_substream *substream)
@ -885,7 +872,6 @@ static const struct snd_pcm_ops capture_pcm_ops = {
.close = capture_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
.hw_params = capture_pcm_hw_params,
.hw_free = ua101_pcm_hw_free,
.prepare = capture_pcm_prepare,
.trigger = capture_pcm_trigger,
.pointer = capture_pcm_pointer,
@ -896,7 +882,6 @@ static const struct snd_pcm_ops playback_pcm_ops = {
.close = playback_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
.hw_params = playback_pcm_hw_params,
.hw_free = ua101_pcm_hw_free,
.prepare = playback_pcm_prepare,
.trigger = playback_pcm_trigger,
.pointer = playback_pcm_pointer,
@ -1294,8 +1279,8 @@ static int ua101_probe(struct usb_interface *interface,
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_CAPTURE, &capture_pcm_ops);
snd_pcm_lib_preallocate_pages_for_all(ua->pcm, SNDRV_DMA_TYPE_VMALLOC,
NULL, 0, 0);
snd_pcm_set_managed_buffer_all(ua->pcm, SNDRV_DMA_TYPE_VMALLOC,
NULL, 0, 0);
err = snd_usbmidi_create(card, ua->intf[INTF_MIDI],
&ua->midi_list, &midi_quirk);