ALSA: cs4281: Use managed buffer allocation
authorTakashi Iwai <tiwai@suse.de>
Mon, 9 Dec 2019 09:49:03 +0000 (10:49 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 11 Dec 2019 06:25:08 +0000 (07:25 +0100)
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>
sound/pci/cs4281.c

index 058c141..ea665d4 100644 (file)
@@ -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,9 +959,8 @@ 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,
-                                             64*1024, 512*1024);
+       snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
+                                      64*1024, 512*1024);
 
        return 0;
 }