ALSA: ad1816a: Use managed buffer allocation
authorTakashi Iwai <tiwai@suse.de>
Mon, 9 Dec 2019 09:48:42 +0000 (10:48 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 11 Dec 2019 06:24:59 +0000 (07:24 +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-11-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/isa/ad1816a/ad1816a_lib.c

index c4c60ebe241738562fc28c606a90311540cbd153..adc35051c5e990c3c348bb989e7a4287beaefc1e 100644 (file)
@@ -206,17 +206,6 @@ static int snd_ad1816a_capture_trigger(struct snd_pcm_substream *substream, int
                                   SNDRV_PCM_STREAM_CAPTURE, cmd, 1);
 }
 
-static int snd_ad1816a_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_ad1816a_hw_free(struct snd_pcm_substream *substream)
-{
-       return snd_pcm_lib_free_pages(substream);
-}
-
 static int snd_ad1816a_playback_prepare(struct snd_pcm_substream *substream)
 {
        struct snd_ad1816a *chip = snd_pcm_substream_chip(substream);
@@ -645,8 +634,6 @@ static const struct snd_pcm_ops snd_ad1816a_playback_ops = {
        .open =         snd_ad1816a_playback_open,
        .close =        snd_ad1816a_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
-       .hw_params =    snd_ad1816a_hw_params,
-       .hw_free =      snd_ad1816a_hw_free,
        .prepare =      snd_ad1816a_playback_prepare,
        .trigger =      snd_ad1816a_playback_trigger,
        .pointer =      snd_ad1816a_playback_pointer,
@@ -656,8 +643,6 @@ static const struct snd_pcm_ops snd_ad1816a_capture_ops = {
        .open =         snd_ad1816a_capture_open,
        .close =        snd_ad1816a_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
-       .hw_params =    snd_ad1816a_hw_params,
-       .hw_free =      snd_ad1816a_hw_free,
        .prepare =      snd_ad1816a_capture_prepare,
        .trigger =      snd_ad1816a_capture_trigger,
        .pointer =      snd_ad1816a_capture_pointer,
@@ -680,9 +665,8 @@ int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device)
        strcpy(pcm->name, snd_ad1816a_chip_id(chip));
        snd_ad1816a_init(chip);
 
-       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
-                                             chip->card->dev,
-                                             64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
+       snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, chip->card->dev,
+                                      64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
 
        chip->pcm = pcm;
        return 0;