ALSA: aoa: Use managed buffer allocation
authorTakashi Iwai <tiwai@suse.de>
Mon, 9 Dec 2019 09:48:33 +0000 (10:48 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 11 Dec 2019 06:24:55 +0000 (07:24 +0100)
Clean up the driver with the new managed buffer allocation API.
The hw_params callbacks became superfluous and got dropped.

Link: https://lore.kernel.org/r/20191209094943.14984-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/aoa/soundbus/i2sbus/pcm.c

index a94e4023fadf8d1e21f35781c38ca469575a2247..44397e72c8689d06bed42ed6275fdd6488183463 100644 (file)
@@ -294,12 +294,6 @@ void i2sbus_wait_for_stop_both(struct i2sbus_dev *i2sdev)
 }
 #endif
 
-static int i2sbus_hw_params(struct snd_pcm_substream *substream,
-                           struct snd_pcm_hw_params *params)
-{
-       return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
-}
-
 static inline int i2sbus_hw_free(struct snd_pcm_substream *substream, int in)
 {
        struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream);
@@ -308,7 +302,6 @@ static inline int i2sbus_hw_free(struct snd_pcm_substream *substream, int in)
        get_pcm_info(i2sdev, in, &pi, NULL);
        if (pi->dbdma_ring.stopping)
                i2sbus_wait_for_stop(i2sdev, pi);
-       snd_pcm_lib_free_pages(substream);
        return 0;
 }
 
@@ -781,7 +774,6 @@ static const struct snd_pcm_ops i2sbus_playback_ops = {
        .open =         i2sbus_playback_open,
        .close =        i2sbus_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
-       .hw_params =    i2sbus_hw_params,
        .hw_free =      i2sbus_playback_hw_free,
        .prepare =      i2sbus_playback_prepare,
        .trigger =      i2sbus_playback_trigger,
@@ -851,7 +843,6 @@ static const struct snd_pcm_ops i2sbus_record_ops = {
        .open =         i2sbus_record_open,
        .close =        i2sbus_record_close,
        .ioctl =        snd_pcm_lib_ioctl,
-       .hw_params =    i2sbus_hw_params,
        .hw_free =      i2sbus_record_hw_free,
        .prepare =      i2sbus_record_prepare,
        .trigger =      i2sbus_record_trigger,
@@ -1026,7 +1017,7 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card,
        dev->pcm->private_free = i2sbus_private_free;
 
        /* well, we really should support scatter/gather DMA */
-       snd_pcm_lib_preallocate_pages_for_all(
+       snd_pcm_set_managed_buffer_all(
                dev->pcm, SNDRV_DMA_TYPE_DEV,
                &macio_get_pci_dev(i2sdev->macio)->dev,
                64 * 1024, 64 * 1024);