diff options
author | Christoph Hellwig <[email protected]> | 2016-01-20 15:01:22 -0800 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2016-01-20 17:09:18 -0800 |
commit | 0d4a619b64bad7117947a84a10c17a2b8f14d252 (patch) | |
tree | 07ce1a6bfc43b0e0fb54f3231923c1f893938ff8 | |
parent | f9ed89e17ee7d1f5f25615bb0080b9a3ff1bb5f0 (diff) |
dma-mapping: make the generic coherent dma mmap implementation optional
This series converts all remaining architectures to use dma_map_ops and
the generic implementation of the DMA API. This not only simplifies the
code a lot, but also prepares for possible future changes like more
generic non-iommu dma_ops implementations or generic per-device
dma_map_ops.
This patch (of 16):
We have a couple architectures that do not want to support this code, so
add another Kconfig symbol that disables the code similar to what we do
for the nommu case.
Signed-off-by: Christoph Hellwig <[email protected]>
Cc: Haavard Skinnemoen <[email protected]>
Cc: Hans-Christian Egtvedt <[email protected]>
Cc: Steven Miao <[email protected]>
Cc: Ley Foon Tan <[email protected]>
Cc: David Howells <[email protected]>
Cc: Koichi Yasutake <[email protected]>
Cc: Chris Metcalf <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Aurelien Jacquiot <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: James Hogan <[email protected]>
Cc: Jesper Nilsson <[email protected]>
Cc: Mark Salter <[email protected]>
Cc: Mikael Starvik <[email protected]>
Cc: Vineet Gupta <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Sebastian Ott <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | arch/Kconfig | 3 | ||||
-rw-r--r-- | drivers/base/dma-mapping.c | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/arch/Kconfig b/arch/Kconfig index ba1b626bca00..51c03efb4083 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -632,4 +632,7 @@ config OLD_SIGACTION config COMPAT_OLD_SIGACTION bool +config ARCH_NO_COHERENT_DMA_MMAP + bool + source "kernel/gcov/Kconfig" diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c index d95c5971c225..381e39d5204e 100644 --- a/drivers/base/dma-mapping.c +++ b/drivers/base/dma-mapping.c @@ -247,7 +247,7 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, dma_addr_t dma_addr, size_t size) { int ret = -ENXIO; -#ifdef CONFIG_MMU +#if defined(CONFIG_MMU) && !defined(CONFIG_ARCH_NO_COHERENT_DMA_MMAP) unsigned long user_count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT; unsigned long pfn = page_to_pfn(virt_to_page(cpu_addr)); @@ -264,7 +264,7 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, user_count << PAGE_SHIFT, vma->vm_page_prot); } -#endif /* CONFIG_MMU */ +#endif /* CONFIG_MMU && !CONFIG_ARCH_NO_COHERENT_DMA_MMAP */ return ret; } |