ASoC: xtensa: Use managed buffer allocation
authorTakashi Iwai <tiwai@suse.de>
Tue, 10 Dec 2019 14:26:07 +0000 (15:26 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 11 Dec 2019 16:43:26 +0000 (16:43 +0000)
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.

Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20191210142614.19405-17-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/xtensa/xtfpga-i2s.c

index 5dae9c8583b7175aef66c1abcf8ee179807cf411..bcf442faff7cbba2775d73ecd9599d55d3dcfa16 100644 (file)
@@ -390,7 +390,6 @@ static int xtfpga_pcm_hw_params(struct snd_soc_component *component,
                                struct snd_pcm_substream *substream,
                                struct snd_pcm_hw_params *hw_params)
 {
-       int ret;
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct xtfpga_i2s *i2s = runtime->private_data;
        unsigned channels = params_channels(hw_params);
@@ -422,9 +421,7 @@ static int xtfpga_pcm_hw_params(struct snd_soc_component *component,
                return -EINVAL;
        }
 
-       ret = snd_pcm_lib_malloc_pages(substream,
-                                      params_buffer_bytes(hw_params));
-       return ret;
+       return 0;
 }
 
 static int xtfpga_pcm_trigger(struct snd_soc_component *component,
@@ -472,8 +469,8 @@ static int xtfpga_pcm_new(struct snd_soc_component *component,
        struct snd_card *card = rtd->card->snd_card;
        size_t size = xtfpga_pcm_hardware.buffer_bytes_max;
 
-       snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_DEV,
-                                             card->dev, size, size);
+       snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV,
+                                      card->dev, size, size);
        return 0;
 }