ALSA: snd-usb-caiaq: use vmalloc buffers
authorAntonio Ospite <ao2@amarulasolutions.com>
Fri, 21 Jun 2013 11:11:49 +0000 (13:11 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 21 Jun 2013 12:35:52 +0000 (14:35 +0200)
For USB devices it's not necessary to allocate physically contiguous
buffers.

Signed-off-by: Antonio Ospite <ao2@amarulasolutions.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/caiaq/audio.c

index c1916184e2e1e604955b19ba0f9ae23b4788cc2a..7103b0908d130436743bceb6bf422222bd421466 100644 (file)
@@ -183,14 +183,15 @@ static int snd_usb_caiaq_substream_close(struct snd_pcm_substream *substream)
 static int snd_usb_caiaq_pcm_hw_params(struct snd_pcm_substream *sub,
                                       struct snd_pcm_hw_params *hw_params)
 {
-       return snd_pcm_lib_malloc_pages(sub, params_buffer_bytes(hw_params));
+       return snd_pcm_lib_alloc_vmalloc_buffer(sub,
+                                               params_buffer_bytes(hw_params));
 }
 
 static int snd_usb_caiaq_pcm_hw_free(struct snd_pcm_substream *sub)
 {
        struct snd_usb_caiaqdev *cdev = snd_pcm_substream_chip(sub);
        deactivate_substream(cdev, sub);
-       return snd_pcm_lib_free_pages(sub);
+       return snd_pcm_lib_free_vmalloc_buffer(sub);
 }
 
 /* this should probably go upstream */
@@ -345,7 +346,9 @@ static struct snd_pcm_ops snd_usb_caiaq_ops = {
        .hw_free =      snd_usb_caiaq_pcm_hw_free,
        .prepare =      snd_usb_caiaq_pcm_prepare,
        .trigger =      snd_usb_caiaq_pcm_trigger,
-       .pointer =      snd_usb_caiaq_pcm_pointer
+       .pointer =      snd_usb_caiaq_pcm_pointer,
+       .page =         snd_pcm_lib_get_vmalloc_page,
+       .mmap =         snd_pcm_lib_mmap_vmalloc,
 };
 
 static void check_for_elapsed_periods(struct snd_usb_caiaqdev *cdev,
@@ -852,11 +855,6 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev)
        snd_pcm_set_ops(cdev->pcm, SNDRV_PCM_STREAM_CAPTURE,
                                &snd_usb_caiaq_ops);
 
-       snd_pcm_lib_preallocate_pages_for_all(cdev->pcm,
-                                       SNDRV_DMA_TYPE_CONTINUOUS,
-                                       snd_dma_continuous_data(GFP_KERNEL),
-                                       MAX_BUFFER_SIZE, MAX_BUFFER_SIZE);
-
        cdev->data_cb_info =
                kmalloc(sizeof(struct snd_usb_caiaq_cb_info) * N_URBS,
                                        GFP_KERNEL);