ALSA: pcm: Remove arch-dependent mmap kludges
authorTakashi Iwai <tiwai@suse.de>
Wed, 22 Oct 2014 10:01:13 +0000 (12:01 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 22 Oct 2014 10:01:13 +0000 (12:01 +0200)
Since we have consistently dma_mmap_coherent() for all architectures,
the current ifdef and arch-specific codes in pcm core can be cleaned
up gracefully.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/pcm_native.c

index 815396d8427fe68c42d40e7cecf195a2a300180b..aa6754da7929ce54e6901ea037aa844dd74f497c 100644 (file)
@@ -35,9 +35,6 @@
 #include <sound/timer.h>
 #include <sound/minors.h>
 #include <asm/io.h>
-#if defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT)
-#include <dma-coherence.h>
-#endif
 
 /*
  *  Compatibility
@@ -3251,20 +3248,6 @@ static inline struct page *
 snd_pcm_default_page_ops(struct snd_pcm_substream *substream, unsigned long ofs)
 {
        void *vaddr = substream->runtime->dma_area + ofs;
-#if defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT)
-       if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV)
-               return virt_to_page(CAC_ADDR(vaddr));
-#endif
-#if defined(CONFIG_PPC32) && defined(CONFIG_NOT_COHERENT_CACHE)
-       if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV) {
-               dma_addr_t addr = substream->runtime->dma_addr + ofs;
-               addr -= get_dma_offset(substream->dma_buffer.dev.dev);
-               /* assume dma_handle set via pfn_to_phys() in
-                * mm/dma-noncoherent.c
-                */
-               return pfn_to_page(addr >> PAGE_SHIFT);
-       }
-#endif
        return virt_to_page(vaddr);
 }
 
@@ -3309,13 +3292,6 @@ static const struct vm_operations_struct snd_pcm_vm_ops_data_fault = {
        .fault =        snd_pcm_mmap_data_fault,
 };
 
-#ifndef ARCH_HAS_DMA_MMAP_COHERENT
-/* This should be defined / handled globally! */
-#if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
-#define ARCH_HAS_DMA_MMAP_COHERENT
-#endif
-#endif
-
 /*
  * mmap the DMA buffer on RAM
  */
@@ -3331,7 +3307,6 @@ int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream,
                                area->vm_end - area->vm_start, area->vm_page_prot);
        }
 #endif /* CONFIG_GENERIC_ALLOCATOR */
-#ifdef ARCH_HAS_DMA_MMAP_COHERENT
        if (!substream->ops->page &&
            substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV)
                return dma_mmap_coherent(substream->dma_buffer.dev.dev,
@@ -3339,11 +3314,6 @@ int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream,
                                         substream->runtime->dma_area,
                                         substream->runtime->dma_addr,
                                         area->vm_end - area->vm_start);
-#elif defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT)
-       if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV &&
-           !plat_device_is_coherent(substream->dma_buffer.dev.dev))
-               area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
-#endif /* ARCH_HAS_DMA_MMAP_COHERENT */
        /* mmap with fault handler */
        area->vm_ops = &snd_pcm_vm_ops_data_fault;
        return 0;