diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-12-09 10:49:41 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-12-11 07:25:24 +0100 |
commit | 3f0c972ad828b5b1a44563c2ceea0f140827013b (patch) | |
tree | 691ce913f7f891bafcdf291fb6746d57ec329aff /sound/usb/usx2y | |
parent | 8aa77f9cab9aead9f684d2a19d11515f468465f1 (diff) |
ALSA: usx2y: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API.
The superfluous snd_pcm_lib_malloc_pages() and
snd_pcm_lib_free_pages() calls are dropped.
Link: https://lore.kernel.org/r/20191209094943.14984-70-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/usx2y')
-rw-r--r-- | sound/usb/usx2y/usbusx2yaudio.c | 26 | ||||
-rw-r--r-- | sound/usb/usx2y/usx2yhwdeppcm.c | 18 |
2 files changed, 18 insertions, 26 deletions
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index 25a0939f410a..7eb9805a4326 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c @@ -764,14 +764,6 @@ static int snd_usX2Y_pcm_hw_params(struct snd_pcm_substream *substream, } } - err = snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); - if (err < 0) { - snd_printk(KERN_ERR "snd_pcm_lib_malloc_pages(%p, %i) returned %i\n", - substream, params_buffer_bytes(hw_params), err); - goto error; - } - error: mutex_unlock(&usX2Y(card)->pcm_mutex); return err; @@ -806,7 +798,7 @@ static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream) } } mutex_unlock(&subs->usX2Y->pcm_mutex); - return snd_pcm_lib_free_pages(substream); + return 0; } /* * prepare callback @@ -968,16 +960,16 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->pcm_devs); if (playback_endpoint) { - snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, - SNDRV_DMA_TYPE_CONTINUOUS, - NULL, - 64*1024, 128*1024); + snd_pcm_set_managed_buffer(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, + SNDRV_DMA_TYPE_CONTINUOUS, + NULL, + 64*1024, 128*1024); } - snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, - SNDRV_DMA_TYPE_CONTINUOUS, - NULL, - 64*1024, 128*1024); + snd_pcm_set_managed_buffer(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, + SNDRV_DMA_TYPE_CONTINUOUS, + NULL, + 64*1024, 128*1024); usX2Y(card)->pcm_devs++; return 0; diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 997493e839ee..419d9f07d197 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c @@ -376,7 +376,7 @@ static int snd_usX2Y_usbpcm_hw_free(struct snd_pcm_substream *substream) } } mutex_unlock(&subs->usX2Y->pcm_mutex); - return snd_pcm_lib_free_pages(substream); + return 0; } static void usX2Y_usbpcm_subs_startup(struct snd_usX2Y_substream *subs) @@ -726,14 +726,14 @@ int usX2Y_hwdep_pcm_new(struct snd_card *card) pcm->info_flags = 0; sprintf(pcm->name, NAME_ALLCAPS" hwdep Audio"); - snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, - SNDRV_DMA_TYPE_CONTINUOUS, - NULL, - 64*1024, 128*1024); - snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, - SNDRV_DMA_TYPE_CONTINUOUS, - NULL, - 64*1024, 128*1024); + snd_pcm_set_managed_buffer(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, + SNDRV_DMA_TYPE_CONTINUOUS, + NULL, + 64*1024, 128*1024); + snd_pcm_set_managed_buffer(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, + SNDRV_DMA_TYPE_CONTINUOUS, + NULL, + 64*1024, 128*1024); return 0; } |