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

index 0499dc863202876651791e7ec173e6d6028d8fee..19d8238e130ce00cfa34ba26f0d4400c0c5b50f1 100644 (file)
@@ -856,17 +856,6 @@ static int snd_ensoniq_trigger(struct snd_pcm_substream *substream, int cmd)
  *  PCM part
  */
 
-static int snd_ensoniq_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_ensoniq_hw_free(struct snd_pcm_substream *substream)
-{
-       return snd_pcm_lib_free_pages(substream);
-}
-
 static int snd_ensoniq_playback1_prepare(struct snd_pcm_substream *substream)
 {
        struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
@@ -1216,8 +1205,6 @@ static const struct snd_pcm_ops snd_ensoniq_playback1_ops = {
        .open =         snd_ensoniq_playback1_open,
        .close =        snd_ensoniq_playback1_close,
        .ioctl =        snd_pcm_lib_ioctl,
-       .hw_params =    snd_ensoniq_hw_params,
-       .hw_free =      snd_ensoniq_hw_free,
        .prepare =      snd_ensoniq_playback1_prepare,
        .trigger =      snd_ensoniq_trigger,
        .pointer =      snd_ensoniq_playback1_pointer,
@@ -1227,8 +1214,6 @@ static const struct snd_pcm_ops snd_ensoniq_playback2_ops = {
        .open =         snd_ensoniq_playback2_open,
        .close =        snd_ensoniq_playback2_close,
        .ioctl =        snd_pcm_lib_ioctl,
-       .hw_params =    snd_ensoniq_hw_params,
-       .hw_free =      snd_ensoniq_hw_free,
        .prepare =      snd_ensoniq_playback2_prepare,
        .trigger =      snd_ensoniq_trigger,
        .pointer =      snd_ensoniq_playback2_pointer,
@@ -1238,8 +1223,6 @@ static const struct snd_pcm_ops snd_ensoniq_capture_ops = {
        .open =         snd_ensoniq_capture_open,
        .close =        snd_ensoniq_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
-       .hw_params =    snd_ensoniq_hw_params,
-       .hw_free =      snd_ensoniq_hw_free,
        .prepare =      snd_ensoniq_capture_prepare,
        .trigger =      snd_ensoniq_trigger,
        .pointer =      snd_ensoniq_capture_pointer,
@@ -1274,9 +1257,8 @@ static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device)
        strcpy(pcm->name, CHIP_NAME " DAC2/ADC");
        ensoniq->pcm1 = pcm;
 
-       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
-                                             &ensoniq->pci->dev,
-                                             64*1024, 128*1024);
+       snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
+                                      &ensoniq->pci->dev, 64*1024, 128*1024);
 
 #ifdef CHIP1370
        err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
@@ -1307,9 +1289,8 @@ static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device)
        strcpy(pcm->name, CHIP_NAME " DAC1");
        ensoniq->pcm2 = pcm;
 
-       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
-                                             &ensoniq->pci->dev,
-                                             64*1024, 128*1024);
+       snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
+                                      &ensoniq->pci->dev, 64*1024, 128*1024);
 
 #ifdef CHIP1370
        err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,