ALSA: pcsp: 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() are dropped. Link: https://lore.kernel.org/r/20191209094943.14984-8-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
cbd0719d51
commit
d635f09e91
|
@ -214,12 +214,7 @@ static int snd_pcsp_playback_hw_params(struct snd_pcm_substream *substream,
|
||||||
struct snd_pcm_hw_params *hw_params)
|
struct snd_pcm_hw_params *hw_params)
|
||||||
{
|
{
|
||||||
struct snd_pcsp *chip = snd_pcm_substream_chip(substream);
|
struct snd_pcsp *chip = snd_pcm_substream_chip(substream);
|
||||||
int err;
|
|
||||||
pcsp_sync_stop(chip);
|
pcsp_sync_stop(chip);
|
||||||
err = snd_pcm_lib_malloc_pages(substream,
|
|
||||||
params_buffer_bytes(hw_params));
|
|
||||||
if (err < 0)
|
|
||||||
return err;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +225,7 @@ static int snd_pcsp_playback_hw_free(struct snd_pcm_substream *substream)
|
||||||
printk(KERN_INFO "PCSP: hw_free called\n");
|
printk(KERN_INFO "PCSP: hw_free called\n");
|
||||||
#endif
|
#endif
|
||||||
pcsp_sync_stop(chip);
|
pcsp_sync_stop(chip);
|
||||||
return snd_pcm_lib_free_pages(substream);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_pcsp_playback_prepare(struct snd_pcm_substream *substream)
|
static int snd_pcsp_playback_prepare(struct snd_pcm_substream *substream)
|
||||||
|
@ -350,7 +345,7 @@ int snd_pcsp_new_pcm(struct snd_pcsp *chip)
|
||||||
chip->pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;
|
chip->pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;
|
||||||
strcpy(chip->pcm->name, "pcsp");
|
strcpy(chip->pcm->name, "pcsp");
|
||||||
|
|
||||||
snd_pcm_lib_preallocate_pages_for_all(chip->pcm,
|
snd_pcm_set_managed_buffer_all(chip->pcm,
|
||||||
SNDRV_DMA_TYPE_CONTINUOUS,
|
SNDRV_DMA_TYPE_CONTINUOUS,
|
||||||
NULL,
|
NULL,
|
||||||
PCSP_BUFFER_SIZE,
|
PCSP_BUFFER_SIZE,
|
||||||
|
|
Loading…
Reference in New Issue