OSDN Git Service

staging: bcm2835-audio: Use managed buffer allocation
authorTakashi Iwai <tiwai@suse.de>
Tue, 10 Dec 2019 14:13:54 +0000 (15:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Dec 2019 14:42:41 +0000 (15:42 +0100)
Clean up the driver with the new managed buffer allocation API.
The hw_params and hw_free callbacks became superfluous and dropped.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20191210141356.18074-3-tiwai@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c

index 826016c..97726b1 100644 (file)
@@ -193,17 +193,6 @@ static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static int snd_bcm2835_pcm_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 int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream)
-{
-       return snd_pcm_lib_free_pages(substream);
-}
-
 static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream)
 {
        struct bcm2835_chip *chip = snd_pcm_substream_chip(substream);
@@ -317,8 +306,6 @@ static const struct snd_pcm_ops snd_bcm2835_playback_ops = {
        .open = snd_bcm2835_playback_open,
        .close = snd_bcm2835_playback_close,
        .ioctl = snd_pcm_lib_ioctl,
-       .hw_params = snd_bcm2835_pcm_hw_params,
-       .hw_free = snd_bcm2835_pcm_hw_free,
        .prepare = snd_bcm2835_pcm_prepare,
        .trigger = snd_bcm2835_pcm_trigger,
        .pointer = snd_bcm2835_pcm_pointer,
@@ -329,8 +316,6 @@ static const struct snd_pcm_ops snd_bcm2835_playback_spdif_ops = {
        .open = snd_bcm2835_playback_spdif_open,
        .close = snd_bcm2835_playback_close,
        .ioctl = snd_pcm_lib_ioctl,
-       .hw_params = snd_bcm2835_pcm_hw_params,
-       .hw_free = snd_bcm2835_pcm_hw_free,
        .prepare = snd_bcm2835_pcm_prepare,
        .trigger = snd_bcm2835_pcm_trigger,
        .pointer = snd_bcm2835_pcm_pointer,
@@ -362,7 +347,7 @@ int snd_bcm2835_new_pcm(struct bcm2835_chip *chip, const char *name,
                        spdif ? &snd_bcm2835_playback_spdif_ops :
                        &snd_bcm2835_playback_ops);
 
-       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
+       snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
                chip->card->dev, 128 * 1024, 128 * 1024);
 
        if (spdif)