From: Linus Torvalds Date: Fri, 19 Apr 2013 17:01:04 +0000 (-0700) Subject: vm: convert snd_pcm_lib_mmap_iomem() to vm_iomap_memory() helper X-Git-Tag: v3.4.42~5 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ada37d85783ec8e314bd9b020b89d8a63a7587f2;p=karo-tx-linux.git vm: convert snd_pcm_lib_mmap_iomem() to vm_iomap_memory() helper commit 0fe09a45c4848b5b5607b968d959fdc1821c161d upstream. This is my example conversion of a few existing mmap users. The pcm mmap case is one of the more straightforward ones. Acked-by: Takashi Iwai Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index d535b341aa82..d776291d09a0 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -3209,18 +3209,10 @@ EXPORT_SYMBOL_GPL(snd_pcm_lib_default_mmap); int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_struct *area) { - long size; - unsigned long offset; + struct snd_pcm_runtime *runtime = substream->runtime;; area->vm_page_prot = pgprot_noncached(area->vm_page_prot); - area->vm_flags |= VM_IO; - size = area->vm_end - area->vm_start; - offset = area->vm_pgoff << PAGE_SHIFT; - if (io_remap_pfn_range(area, area->vm_start, - (substream->runtime->dma_addr + offset) >> PAGE_SHIFT, - size, area->vm_page_prot)) - return -EAGAIN; - return 0; + return vm_iomap_memory(area, runtime->dma_addr, runtime->dma_bytes); } EXPORT_SYMBOL(snd_pcm_lib_mmap_iomem);