summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-06-14 15:59:14 +0200
committerChristoph Hellwig <hch@lst.de>2019-06-25 14:27:58 +0200
commitc2f2124e0d447ad02a41a92361b3734366797680 (patch)
tree01b1d3e6e2d3f0f93e01b15ce1fac97aed58e841 /kernel
parentdma-mapping: add a dma_alloc_need_uncached helper (diff)
downloadlinux-c2f2124e0d447ad02a41a92361b3734366797680.tar.xz
linux-c2f2124e0d447ad02a41a92361b3734366797680.zip
dma-direct: handle DMA_ATTR_NON_CONSISTENT in common code
Only call into arch_dma_alloc if we require an uncached mapping, and remove the parisc code manually doing normal cached DMA_ATTR_NON_CONSISTENT allocations. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Helge Deller <deller@gmx.de> # parisc
Diffstat (limited to 'kernel')
-rw-r--r--kernel/dma/direct.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
index c2893713bf80..fc354f4f490b 100644
--- a/kernel/dma/direct.c
+++ b/kernel/dma/direct.c
@@ -191,7 +191,7 @@ void *dma_direct_alloc(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
{
if (!IS_ENABLED(CONFIG_ARCH_HAS_UNCACHED_SEGMENT) &&
- !dev_is_dma_coherent(dev))
+ dma_alloc_need_uncached(dev, attrs))
return arch_dma_alloc(dev, size, dma_handle, gfp, attrs);
return dma_direct_alloc_pages(dev, size, dma_handle, gfp, attrs);
}
@@ -200,7 +200,7 @@ void dma_direct_free(struct device *dev, size_t size,
void *cpu_addr, dma_addr_t dma_addr, unsigned long attrs)
{
if (!IS_ENABLED(CONFIG_ARCH_HAS_UNCACHED_SEGMENT) &&
- !dev_is_dma_coherent(dev))
+ dma_alloc_need_uncached(dev, attrs))
arch_dma_free(dev, size, cpu_addr, dma_addr, attrs);
else
dma_direct_free_pages(dev, size, cpu_addr, dma_addr, attrs);