aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Semwal <sumit.semwal@ti.com>2012-01-27 04:39:27 -0500
committerSumit Semwal <sumit.semwal@ti.com>2012-03-26 02:01:58 -0400
commit33ea2dcb39ba50b0b69d1b1dc24702f084b46411 (patch)
treeec1e1b0c223e09861341f82d2aa0b13ec841be95
parent2ed9201bdd9a8e462d768a838fb2bc944c6887a4 (diff)
dma-buf: add dma_data_direction to unmap dma_buf_op
Some exporters may use DMA map/unmap APIs in dma-buf ops, which require enum dma_data_direction for both map and unmap operations. Thus, the unmap dma_buf_op also needs to have enum dma_data_direction as a parameter. Reported-by: Tomasz Stanislawski <t.stanislaws@samsung.com> Signed-off-by: Sumit Semwal <sumit.semwal@ti.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
-rw-r--r--drivers/base/dma-buf.c7
-rw-r--r--include/linux/dma-buf.h8
2 files changed, 10 insertions, 5 deletions
diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c
index 8afe2dd17912..c9a945fd1a04 100644
--- a/drivers/base/dma-buf.c
+++ b/drivers/base/dma-buf.c
@@ -271,16 +271,19 @@ EXPORT_SYMBOL_GPL(dma_buf_map_attachment);
271 * dma_buf_ops. 271 * dma_buf_ops.
272 * @attach: [in] attachment to unmap buffer from 272 * @attach: [in] attachment to unmap buffer from
273 * @sg_table: [in] scatterlist info of the buffer to unmap 273 * @sg_table: [in] scatterlist info of the buffer to unmap
274 * @direction: [in] direction of DMA transfer
274 * 275 *
275 */ 276 */
276void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, 277void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
277 struct sg_table *sg_table) 278 struct sg_table *sg_table,
279 enum dma_data_direction direction)
278{ 280{
279 if (WARN_ON(!attach || !attach->dmabuf || !sg_table)) 281 if (WARN_ON(!attach || !attach->dmabuf || !sg_table))
280 return; 282 return;
281 283
282 mutex_lock(&attach->dmabuf->lock); 284 mutex_lock(&attach->dmabuf->lock);
283 attach->dmabuf->ops->unmap_dma_buf(attach, sg_table); 285 attach->dmabuf->ops->unmap_dma_buf(attach, sg_table,
286 direction);
284 mutex_unlock(&attach->dmabuf->lock); 287 mutex_unlock(&attach->dmabuf->lock);
285 288
286} 289}
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index 86f624141048..a885b2689b8f 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -63,7 +63,8 @@ struct dma_buf_ops {
63 struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *, 63 struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *,
64 enum dma_data_direction); 64 enum dma_data_direction);
65 void (*unmap_dma_buf)(struct dma_buf_attachment *, 65 void (*unmap_dma_buf)(struct dma_buf_attachment *,
66 struct sg_table *); 66 struct sg_table *,
67 enum dma_data_direction);
67 /* TODO: Add try_map_dma_buf version, to return immed with -EBUSY 68 /* TODO: Add try_map_dma_buf version, to return immed with -EBUSY
68 * if the call would block. 69 * if the call would block.
69 */ 70 */
@@ -122,7 +123,8 @@ void dma_buf_put(struct dma_buf *dmabuf);
122 123
123struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *, 124struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *,
124 enum dma_data_direction); 125 enum dma_data_direction);
125void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *); 126void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *,
127 enum dma_data_direction);
126#else 128#else
127 129
128static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, 130static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
@@ -166,7 +168,7 @@ static inline struct sg_table *dma_buf_map_attachment(
166} 168}
167 169
168static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, 170static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
169 struct sg_table *sg) 171 struct sg_table *sg, enum dma_data_direction dir)
170{ 172{
171 return; 173 return;
172} 174}