Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use vmalloc buffers

For USB devices it's not necessary to allocate physically contiguous
buffers as there won't be DMA from the device.

Signed-off-by: Antonio Ospite <ao2@amarulasolutions.com>
  • Loading branch information...
commit 7cc042dda89e3705dbca6edb6744ea068e01a115 1 parent ae935cc
@ao2 ao2 authored
Showing with 5 additions and 7 deletions.
  1. +5 −7 pcm.c
View
12 pcm.c
@@ -425,14 +425,14 @@ static int hiface_pcm_hw_params(struct snd_pcm_substream *alsa_sub,
struct snd_pcm_hw_params *hw_params)
{
pr_debug("%s: called.\n", __func__);
- return snd_pcm_lib_malloc_pages(alsa_sub,
- params_buffer_bytes(hw_params));
+ return snd_pcm_lib_alloc_vmalloc_buffer(alsa_sub,
+ params_buffer_bytes(hw_params));
}
static int hiface_pcm_hw_free(struct snd_pcm_substream *alsa_sub)
{
pr_debug("%s: called.\n", __func__);
- return snd_pcm_lib_free_pages(alsa_sub);
+ return snd_pcm_lib_free_vmalloc_buffer(alsa_sub);
}
static int hiface_pcm_prepare(struct snd_pcm_substream *alsa_sub)
@@ -528,6 +528,8 @@ static struct snd_pcm_ops pcm_ops = {
.prepare = hiface_pcm_prepare,
.trigger = hiface_pcm_trigger,
.pointer = hiface_pcm_pointer,
+ .page = snd_pcm_lib_get_vmalloc_page,
+ .mmap = snd_pcm_lib_mmap_vmalloc,
};
static int hiface_pcm_init_urb(struct pcm_urb *urb,
@@ -622,10 +624,6 @@ int hiface_pcm_init(struct hiface_chip *chip, u8 extra_freq)
strlcpy(pcm->name, "USB-SPDIF Audio", sizeof(pcm->name));
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &pcm_ops);
- snd_pcm_lib_preallocate_pages_for_all(pcm,
- SNDRV_DMA_TYPE_CONTINUOUS,
- snd_dma_continuous_data(GFP_KERNEL),
- PCM_BUFFER_SIZE, PCM_BUFFER_SIZE);
rt->instance = pcm;
chip->pcm = rt;
Please sign in to comment.
Something went wrong with that request. Please try again.