Commit ce747f86 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: spi: Use managed buffer allocation

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

Link: https://lore.kernel.org/r/20191209094943.14984-64-tiwai@suse.de


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 786e90b0
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -242,13 +242,7 @@ static int snd_at73c213_pcm_hw_params(struct snd_pcm_substream *substream,
	val = SSC_BFINS(TFMR_DATNB, channels - 1, val);
	ssc_writel(chip->ssc->regs, TFMR, val);

	return snd_pcm_lib_malloc_pages(substream,
					params_buffer_bytes(hw_params));
}

static int snd_at73c213_pcm_hw_free(struct snd_pcm_substream *substream)
{
	return snd_pcm_lib_free_pages(substream);
	return 0;
}

static int snd_at73c213_pcm_prepare(struct snd_pcm_substream *substream)
@@ -324,7 +318,6 @@ static const struct snd_pcm_ops at73c213_playback_ops = {
	.close		= snd_at73c213_pcm_close,
	.ioctl		= snd_pcm_lib_ioctl,
	.hw_params	= snd_at73c213_pcm_hw_params,
	.hw_free	= snd_at73c213_pcm_hw_free,
	.prepare	= snd_at73c213_pcm_prepare,
	.trigger	= snd_at73c213_pcm_trigger,
	.pointer	= snd_at73c213_pcm_pointer,
@@ -347,7 +340,7 @@ static int snd_at73c213_pcm_new(struct snd_at73c213 *chip, int device)

	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &at73c213_playback_ops);

	snd_pcm_lib_preallocate_pages_for_all(chip->pcm,
	snd_pcm_set_managed_buffer_all(chip->pcm,
			SNDRV_DMA_TYPE_DEV, &chip->ssc->pdev->dev,
			64 * 1024, 64 * 1024);
out: