ALSA: cs5535: Use managed buffer allocation
authorTakashi Iwai <tiwai@suse.de>
Mon, 9 Dec 2019 09:49:04 +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 superfluous snd_pcm_lib_malloc_pages() and
snd_pcm_lib_free_pages() calls are dropped.

Link: https://lore.kernel.org/r/20191209094943.14984-33-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/cs5535audio/cs5535audio_pcm.c

index 4642e5384e831f9c88717c3fe5121593ea96955b..0b2a23c6d277158505c4ad7851366fcc4803171a 100644 (file)
@@ -236,10 +236,6 @@ static int snd_cs5535audio_hw_params(struct snd_pcm_substream *substream,
        struct cs5535audio_dma *dma = substream->runtime->private_data;
        int err;
 
-       err = snd_pcm_lib_malloc_pages(substream,
-                                       params_buffer_bytes(hw_params));
-       if (err < 0)
-               return err;
        dma->buf_addr = substream->runtime->dma_addr;
        dma->buf_bytes = params_buffer_bytes(hw_params);
 
@@ -267,7 +263,7 @@ static int snd_cs5535audio_hw_free(struct snd_pcm_substream *substream)
                dma->pcm_open_flag = 0;
        }
        cs5535audio_clear_dma_packets(cs5535au, dma, substream);
-       return snd_pcm_lib_free_pages(substream);
+       return 0;
 }
 
 static int snd_cs5535audio_playback_prepare(struct snd_pcm_substream *substream)
@@ -431,9 +427,9 @@ int snd_cs5535audio_pcm(struct cs5535audio *cs5535au)
        pcm->info_flags = 0;
        strcpy(pcm->name, "CS5535 Audio");
 
-       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
-                                             &cs5535au->pci->dev,
-                                             64*1024, 128*1024);
+       snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
+                                      &cs5535au->pci->dev,
+                                      64*1024, 128*1024);
        cs5535au->pcm = pcm;
 
        return 0;