summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-01-09 16:30:23 +0100
committerChristoph Hellwig <hch@lst.de>2018-01-15 09:35:06 +0100
commit002e67454f61bb67d8071ac4d0cacb86a01d18e0 (patch)
treeef15f40222144d529cc2e2b2bfdb72fad7fd4510 /lib
parentc5cd037d1c8044fbd131c57822a67a1576eb16e9 (diff)
downloadlinux-002e67454f61bb67d8071ac4d0cacb86a01d18e0.tar.bz2
dma-direct: rename dma_noop to dma_direct
The trivial direct mapping implementation already does a virtual to physical translation which isn't strictly a noop, and will soon learn to do non-direct but linear physical to dma translations through the device offset and a few small tricks. Rename it to a better fitting name. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig2
-rw-r--r--lib/Makefile2
-rw-r--r--lib/dma-direct.c (renamed from lib/dma-noop.c)35
3 files changed, 17 insertions, 22 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index c5e84fbcb30b..9d3d649c9dc9 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -409,7 +409,7 @@ config HAS_DMA
depends on !NO_DMA
default y
-config DMA_NOOP_OPS
+config DMA_DIRECT_OPS
bool
depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
default n
diff --git a/lib/Makefile b/lib/Makefile
index d11c48ec8ffd..749851abe85a 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -28,7 +28,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
lib-$(CONFIG_MMU) += ioremap.o
lib-$(CONFIG_SMP) += cpumask.o
-lib-$(CONFIG_DMA_NOOP_OPS) += dma-noop.o
+lib-$(CONFIG_DMA_DIRECT_OPS) += dma-direct.o
lib-$(CONFIG_DMA_VIRT_OPS) += dma-virt.o
lib-y += kobject.o klist.o
diff --git a/lib/dma-noop.c b/lib/dma-direct.c
index a10185b0c2d4..0ec3262a3148 100644
--- a/lib/dma-noop.c
+++ b/lib/dma-direct.c
@@ -10,9 +10,8 @@
#include <linux/scatterlist.h>
#include <linux/pfn.h>
-static void *dma_noop_alloc(struct device *dev, size_t size,
- dma_addr_t *dma_handle, gfp_t gfp,
- unsigned long attrs)
+static void *dma_direct_alloc(struct device *dev, size_t size,
+ dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
{
void *ret;
@@ -23,24 +22,21 @@ static void *dma_noop_alloc(struct device *dev, size_t size,
return ret;
}
-static void dma_noop_free(struct device *dev, size_t size,
- void *cpu_addr, dma_addr_t dma_addr,
- unsigned long attrs)
+static void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
+ dma_addr_t dma_addr, unsigned long attrs)
{
free_pages((unsigned long)cpu_addr, get_order(size));
}
-static dma_addr_t dma_noop_map_page(struct device *dev, struct page *page,
- unsigned long offset, size_t size,
- enum dma_data_direction dir,
- unsigned long attrs)
+static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+ unsigned long offset, size_t size, enum dma_data_direction dir,
+ unsigned long attrs)
{
return page_to_phys(page) + offset - PFN_PHYS(dev->dma_pfn_offset);
}
-static int dma_noop_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
- enum dma_data_direction dir,
- unsigned long attrs)
+static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
+ int nents, enum dma_data_direction dir, unsigned long attrs)
{
int i;
struct scatterlist *sg;
@@ -58,11 +54,10 @@ static int dma_noop_map_sg(struct device *dev, struct scatterlist *sgl, int nent
return nents;
}
-const struct dma_map_ops dma_noop_ops = {
- .alloc = dma_noop_alloc,
- .free = dma_noop_free,
- .map_page = dma_noop_map_page,
- .map_sg = dma_noop_map_sg,
+const struct dma_map_ops dma_direct_ops = {
+ .alloc = dma_direct_alloc,
+ .free = dma_direct_free,
+ .map_page = dma_direct_map_page,
+ .map_sg = dma_direct_map_sg,
};
-
-EXPORT_SYMBOL(dma_noop_ops);
+EXPORT_SYMBOL(dma_direct_ops);