Commit c6312f39 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: mixart: 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-48-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent e485e538
...@@ -624,10 +624,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs, ...@@ -624,10 +624,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,
return err; return err;
} }
/* allocate buffer */ if (subs->runtime->buffer_changed) {
err = snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw));
if (err > 0) {
struct mixart_bufferinfo *bufferinfo; struct mixart_bufferinfo *bufferinfo;
int i = (chip->chip_idx * MIXART_MAX_STREAM_PER_CARD) + (stream->pcm_number * (MIXART_PLAYBACK_STREAMS+MIXART_CAPTURE_STREAMS)) + subs->number; int i = (chip->chip_idx * MIXART_MAX_STREAM_PER_CARD) + (stream->pcm_number * (MIXART_PLAYBACK_STREAMS+MIXART_CAPTURE_STREAMS)) + subs->number;
if( subs->stream == SNDRV_PCM_STREAM_CAPTURE ) { if( subs->stream == SNDRV_PCM_STREAM_CAPTURE ) {
...@@ -647,13 +644,12 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs, ...@@ -647,13 +644,12 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,
} }
mutex_unlock(&mgr->setup_mutex); mutex_unlock(&mgr->setup_mutex);
return err; return 0;
} }
static int snd_mixart_hw_free(struct snd_pcm_substream *subs) static int snd_mixart_hw_free(struct snd_pcm_substream *subs)
{ {
struct snd_mixart *chip = snd_pcm_substream_chip(subs); struct snd_mixart *chip = snd_pcm_substream_chip(subs);
snd_pcm_lib_free_pages(subs);
mixart_sync_nonblock_events(chip->mgr); mixart_sync_nonblock_events(chip->mgr);
return 0; return 0;
} }
...@@ -947,7 +943,7 @@ static void preallocate_buffers(struct snd_mixart *chip, struct snd_pcm *pcm) ...@@ -947,7 +943,7 @@ static void preallocate_buffers(struct snd_mixart *chip, struct snd_pcm *pcm)
(chip->chip_idx + 1) << 24; (chip->chip_idx + 1) << 24;
} }
#endif #endif
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&chip->mgr->pci->dev, &chip->mgr->pci->dev,
32*1024, 32*1024); 32*1024, 32*1024);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment