Skip to content

Commit

Permalink
dma-buf: add dma_data_direction to unmap dma_buf_op
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sumit Semwal committed Mar 26, 2012
1 parent 2ed9201 commit 33ea2dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions drivers/base/dma-buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,19 @@ EXPORT_SYMBOL_GPL(dma_buf_map_attachment);
* dma_buf_ops.
* @attach: [in] attachment to unmap buffer from
* @sg_table: [in] scatterlist info of the buffer to unmap
* @direction: [in] direction of DMA transfer
*
*/
void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
struct sg_table *sg_table)
struct sg_table *sg_table,
enum dma_data_direction direction)
{
if (WARN_ON(!attach || !attach->dmabuf || !sg_table))
return;

mutex_lock(&attach->dmabuf->lock);
attach->dmabuf->ops->unmap_dma_buf(attach, sg_table);
attach->dmabuf->ops->unmap_dma_buf(attach, sg_table,
direction);
mutex_unlock(&attach->dmabuf->lock);

}
Expand Down
8 changes: 5 additions & 3 deletions include/linux/dma-buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ struct dma_buf_ops {
struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *,
enum dma_data_direction);
void (*unmap_dma_buf)(struct dma_buf_attachment *,
struct sg_table *);
struct sg_table *,
enum dma_data_direction);
/* TODO: Add try_map_dma_buf version, to return immed with -EBUSY
* if the call would block.
*/
Expand Down Expand Up @@ -122,7 +123,8 @@ void dma_buf_put(struct dma_buf *dmabuf);

struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *,
enum dma_data_direction);
void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *);
void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *,
enum dma_data_direction);
#else

static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
Expand Down Expand Up @@ -166,7 +168,7 @@ static inline struct sg_table *dma_buf_map_attachment(
}

static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
struct sg_table *sg)
struct sg_table *sg, enum dma_data_direction dir)
{
return;
}
Expand Down

0 comments on commit 33ea2dc

Please sign in to comment.