ALSA: fm801: 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-40-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
d244a1db6f
commit
247ed10204
@ -435,17 +435,6 @@ static int snd_fm801_capture_trigger(struct snd_pcm_substream *substream,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_fm801_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_fm801_hw_free(struct snd_pcm_substream *substream)
|
|
||||||
{
|
|
||||||
return snd_pcm_lib_free_pages(substream);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_fm801_playback_prepare(struct snd_pcm_substream *substream)
|
static int snd_fm801_playback_prepare(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
struct fm801 *chip = snd_pcm_substream_chip(substream);
|
struct fm801 *chip = snd_pcm_substream_chip(substream);
|
||||||
@ -685,8 +674,6 @@ static const struct snd_pcm_ops snd_fm801_playback_ops = {
|
|||||||
.open = snd_fm801_playback_open,
|
.open = snd_fm801_playback_open,
|
||||||
.close = snd_fm801_playback_close,
|
.close = snd_fm801_playback_close,
|
||||||
.ioctl = snd_pcm_lib_ioctl,
|
.ioctl = snd_pcm_lib_ioctl,
|
||||||
.hw_params = snd_fm801_hw_params,
|
|
||||||
.hw_free = snd_fm801_hw_free,
|
|
||||||
.prepare = snd_fm801_playback_prepare,
|
.prepare = snd_fm801_playback_prepare,
|
||||||
.trigger = snd_fm801_playback_trigger,
|
.trigger = snd_fm801_playback_trigger,
|
||||||
.pointer = snd_fm801_playback_pointer,
|
.pointer = snd_fm801_playback_pointer,
|
||||||
@ -696,8 +683,6 @@ static const struct snd_pcm_ops snd_fm801_capture_ops = {
|
|||||||
.open = snd_fm801_capture_open,
|
.open = snd_fm801_capture_open,
|
||||||
.close = snd_fm801_capture_close,
|
.close = snd_fm801_capture_close,
|
||||||
.ioctl = snd_pcm_lib_ioctl,
|
.ioctl = snd_pcm_lib_ioctl,
|
||||||
.hw_params = snd_fm801_hw_params,
|
|
||||||
.hw_free = snd_fm801_hw_free,
|
|
||||||
.prepare = snd_fm801_capture_prepare,
|
.prepare = snd_fm801_capture_prepare,
|
||||||
.trigger = snd_fm801_capture_trigger,
|
.trigger = snd_fm801_capture_trigger,
|
||||||
.pointer = snd_fm801_capture_pointer,
|
.pointer = snd_fm801_capture_pointer,
|
||||||
@ -720,9 +705,8 @@ static int snd_fm801_pcm(struct fm801 *chip, int device)
|
|||||||
strcpy(pcm->name, "FM801");
|
strcpy(pcm->name, "FM801");
|
||||||
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, &pdev->dev,
|
||||||
&pdev->dev,
|
chip->multichannel ? 128*1024 : 64*1024, 128*1024);
|
||||||
chip->multichannel ? 128*1024 : 64*1024, 128*1024);
|
|
||||||
|
|
||||||
return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
|
return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
|
||||||
snd_pcm_alt_chmaps,
|
snd_pcm_alt_chmaps,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user