Commit 44e78a1a authored by Takashi Iwai's avatar Takashi Iwai
Browse files

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: default avatarTakashi Iwai <tiwai@suse.de>
parent d841e2e8
Loading
Loading
Loading
Loading
+2 −18
Original line number Diff line number Diff line
@@ -780,17 +780,6 @@ static void snd_cs4281_mode(struct cs4281 *chip, struct cs4281_dma *dma,
	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)
{
	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,
	.close =	snd_cs4281_playback_close,
	.ioctl =	snd_pcm_lib_ioctl,
	.hw_params =	snd_cs4281_hw_params,
	.hw_free =	snd_cs4281_hw_free,
	.prepare =	snd_cs4281_playback_prepare,
	.trigger =	snd_cs4281_trigger,
	.pointer =	snd_cs4281_pointer,
@@ -950,8 +937,6 @@ static const struct snd_pcm_ops snd_cs4281_capture_ops = {
	.open =		snd_cs4281_capture_open,
	.close =	snd_cs4281_capture_close,
	.ioctl =	snd_pcm_lib_ioctl,
	.hw_params =	snd_cs4281_hw_params,
	.hw_free =	snd_cs4281_hw_free,
	.prepare =	snd_cs4281_capture_prepare,
	.trigger =	snd_cs4281_trigger,
	.pointer =	snd_cs4281_pointer,
@@ -974,8 +959,7 @@ static int snd_cs4281_pcm(struct cs4281 *chip, int device)
	strcpy(pcm->name, "CS4281");
	chip->pcm = pcm;

	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
					      &chip->pci->dev,
	snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
				       64*1024, 512*1024);

	return 0;