ALSA: cs4281: Use managed buffer allocation

Clean up the driver with the new managed buffer allocation API.
The hw_params and hw_free callbacks became superfluous and got
dropped.

Link: https://lore.kernel.org/r/20191209094943.14984-32-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2019-12-09 10:49:03 +01:00
parent d841e2e88f
commit 44e78a1a85
1 changed files with 2 additions and 18 deletions

View File

@ -780,17 +780,6 @@ static void snd_cs4281_mode(struct cs4281 *chip, struct cs4281_dma *dma,
snd_cs4281_pokeBA0(chip, dma->regFSIC, 0); snd_cs4281_pokeBA0(chip, dma->regFSIC, 0);
} }
static int snd_cs4281_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
}
static int snd_cs4281_hw_free(struct snd_pcm_substream *substream)
{
return snd_pcm_lib_free_pages(substream);
}
static int snd_cs4281_playback_prepare(struct snd_pcm_substream *substream) static int snd_cs4281_playback_prepare(struct snd_pcm_substream *substream)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
@ -939,8 +928,6 @@ static const struct snd_pcm_ops snd_cs4281_playback_ops = {
.open = snd_cs4281_playback_open, .open = snd_cs4281_playback_open,
.close = snd_cs4281_playback_close, .close = snd_cs4281_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_cs4281_hw_params,
.hw_free = snd_cs4281_hw_free,
.prepare = snd_cs4281_playback_prepare, .prepare = snd_cs4281_playback_prepare,
.trigger = snd_cs4281_trigger, .trigger = snd_cs4281_trigger,
.pointer = snd_cs4281_pointer, .pointer = snd_cs4281_pointer,
@ -950,8 +937,6 @@ static const struct snd_pcm_ops snd_cs4281_capture_ops = {
.open = snd_cs4281_capture_open, .open = snd_cs4281_capture_open,
.close = snd_cs4281_capture_close, .close = snd_cs4281_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_cs4281_hw_params,
.hw_free = snd_cs4281_hw_free,
.prepare = snd_cs4281_capture_prepare, .prepare = snd_cs4281_capture_prepare,
.trigger = snd_cs4281_trigger, .trigger = snd_cs4281_trigger,
.pointer = snd_cs4281_pointer, .pointer = snd_cs4281_pointer,
@ -974,9 +959,8 @@ static int snd_cs4281_pcm(struct cs4281 *chip, int device)
strcpy(pcm->name, "CS4281"); strcpy(pcm->name, "CS4281");
chip->pcm = pcm; chip->pcm = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
&chip->pci->dev, 64*1024, 512*1024);
64*1024, 512*1024);
return 0; return 0;
} }