ALSA: pmac: Use managed buffer allocation
authorTakashi Iwai <tiwai@suse.de>
Mon, 9 Dec 2019 09:49:30 +0000 (10:49 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 11 Dec 2019 06:25:19 +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-59-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/ppc/pmac.c

index 1b11e53f6a629dca9507b64adbef57aecb9bc099..1629f91d7ae27b78721d8b8af34a074b51b324db 100644 (file)
@@ -107,24 +107,6 @@ static inline int another_stream(int stream)
                SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
 }
 
-/*
- * allocate buffers
- */
-static int snd_pmac_pcm_hw_params(struct snd_pcm_substream *subs,
-                                 struct snd_pcm_hw_params *hw_params)
-{
-       return snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw_params));
-}
-
-/*
- * release buffers
- */
-static int snd_pmac_pcm_hw_free(struct snd_pcm_substream *subs)
-{
-       snd_pcm_lib_free_pages(subs);
-       return 0;
-}
-
 /*
  * get a stream of the opposite direction
  */
@@ -672,8 +654,6 @@ static const struct snd_pcm_ops snd_pmac_playback_ops = {
        .open =         snd_pmac_playback_open,
        .close =        snd_pmac_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
-       .hw_params =    snd_pmac_pcm_hw_params,
-       .hw_free =      snd_pmac_pcm_hw_free,
        .prepare =      snd_pmac_playback_prepare,
        .trigger =      snd_pmac_playback_trigger,
        .pointer =      snd_pmac_playback_pointer,
@@ -683,8 +663,6 @@ static const struct snd_pcm_ops snd_pmac_capture_ops = {
        .open =         snd_pmac_capture_open,
        .close =        snd_pmac_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
-       .hw_params =    snd_pmac_pcm_hw_params,
-       .hw_free =      snd_pmac_pcm_hw_free,
        .prepare =      snd_pmac_capture_prepare,
        .trigger =      snd_pmac_capture_trigger,
        .pointer =      snd_pmac_capture_pointer,
@@ -721,9 +699,9 @@ int snd_pmac_pcm_new(struct snd_pmac *chip)
        chip->capture.cur_freqs = chip->freqs_ok;
 
        /* preallocate 64k buffer */
-       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
-                                             &chip->pdev->dev,
-                                             64 * 1024, 64 * 1024);
+       snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
+                                      &chip->pdev->dev,
+                                      64 * 1024, 64 * 1024);
 
        return 0;
 }