aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-03-15 12:56:43 -0400
committerChristoph Hellwig <hch@lst.de>2019-09-04 05:13:17 -0400
commit14451467014b4c8aff6570b44b6d0ee68cd49bc0 (patch)
tree66eec34dfcf1db31d85ebc9b1387e4ec43fe8a58
parent392e879a445008e8e96b872dabaaf5b1eca58729 (diff)
dma-mapping: move the dma_get_sgtable API comments from arm to common code
The comments are spot on and should be near the central API, not just near a single implementation. Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--arch/arm/mm/dma-mapping.c11
-rw-r--r--kernel/dma/mapping.c11
2 files changed, 11 insertions, 11 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index d27b12f61737..0189a757a8f2 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -877,17 +877,6 @@ static void arm_coherent_dma_free(struct device *dev, size_t size, void *cpu_add
877 __arm_dma_free(dev, size, cpu_addr, handle, attrs, true); 877 __arm_dma_free(dev, size, cpu_addr, handle, attrs, true);
878} 878}
879 879
880/*
881 * The whole dma_get_sgtable() idea is fundamentally unsafe - it seems
882 * that the intention is to allow exporting memory allocated via the
883 * coherent DMA APIs through the dma_buf API, which only accepts a
884 * scattertable. This presents a couple of problems:
885 * 1. Not all memory allocated via the coherent DMA APIs is backed by
886 * a struct page
887 * 2. Passing coherent DMA memory into the streaming APIs is not allowed
888 * as we will try to flush the memory through a different alias to that
889 * actually being used (and the flushes are redundant.)
890 */
891int arm_dma_get_sgtable(struct device *dev, struct sg_table *sgt, 880int arm_dma_get_sgtable(struct device *dev, struct sg_table *sgt,
892 void *cpu_addr, dma_addr_t handle, size_t size, 881 void *cpu_addr, dma_addr_t handle, size_t size,
893 unsigned long attrs) 882 unsigned long attrs)
diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
index 72c825c1788e..a136932b8e6d 100644
--- a/kernel/dma/mapping.c
+++ b/kernel/dma/mapping.c
@@ -136,6 +136,17 @@ int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
136 return ret; 136 return ret;
137} 137}
138 138
139/*
140 * The whole dma_get_sgtable() idea is fundamentally unsafe - it seems
141 * that the intention is to allow exporting memory allocated via the
142 * coherent DMA APIs through the dma_buf API, which only accepts a
143 * scattertable. This presents a couple of problems:
144 * 1. Not all memory allocated via the coherent DMA APIs is backed by
145 * a struct page
146 * 2. Passing coherent DMA memory into the streaming APIs is not allowed
147 * as we will try to flush the memory through a different alias to that
148 * actually being used (and the flushes are redundant.)
149 */
139int dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt, 150int dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt,
140 void *cpu_addr, dma_addr_t dma_addr, size_t size, 151 void *cpu_addr, dma_addr_t dma_addr, size_t size,
141 unsigned long attrs) 152 unsigned long attrs)