Commit 0dd32369 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: riptide: 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-51-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent fdaad162
...@@ -1558,8 +1558,7 @@ snd_riptide_hw_params(struct snd_pcm_substream *substream, ...@@ -1558,8 +1558,7 @@ snd_riptide_hw_params(struct snd_pcm_substream *substream,
return err; return err;
} }
data->sgdbuf = (struct sgd *)sgdlist->area; data->sgdbuf = (struct sgd *)sgdlist->area;
return snd_pcm_lib_malloc_pages(substream, return 0;
params_buffer_bytes(hw_params));
} }
static int snd_riptide_hw_free(struct snd_pcm_substream *substream) static int snd_riptide_hw_free(struct snd_pcm_substream *substream)
...@@ -1581,7 +1580,7 @@ static int snd_riptide_hw_free(struct snd_pcm_substream *substream) ...@@ -1581,7 +1580,7 @@ static int snd_riptide_hw_free(struct snd_pcm_substream *substream)
data->sgdlist.area = NULL; data->sgdlist.area = NULL;
} }
} }
return snd_pcm_lib_free_pages(substream); return 0;
} }
static int snd_riptide_playback_open(struct snd_pcm_substream *substream) static int snd_riptide_playback_open(struct snd_pcm_substream *substream)
...@@ -1692,9 +1691,8 @@ static int snd_riptide_pcm(struct snd_riptide *chip, int device) ...@@ -1692,9 +1691,8 @@ static int snd_riptide_pcm(struct snd_riptide *chip, int device)
pcm->info_flags = 0; pcm->info_flags = 0;
strcpy(pcm->name, "RIPTIDE"); strcpy(pcm->name, "RIPTIDE");
chip->pcm = pcm; chip->pcm = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
&chip->pci->dev, &chip->pci->dev, 64 * 1024, 128 * 1024);
64 * 1024, 128 * 1024);
return 0; return 0;
} }
......
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