<p>Hi Laurent, </p>
<p>On Jan 30, 2012 7:48 PM, "Laurent Pinchart" <<a href="mailto:laurent.pinchart@ideasonboard.com">laurent.pinchart@ideasonboard.com</a>> wrote:<br>
><br>
> Hi Sumit,<br>
><br>
> On Friday 27 January 2012 10:43:28 Sumit Semwal wrote:<br>
> > Some exporters may use DMA map/unmap APIs in dma-buf ops, which require<br>
> > enum dma_data_direction for both map and unmap operations.<br>
> ><br>
> > Thus, the unmap dma_buf_op also needs to have enum dma_data_direction as<br>
> > a parameter.<br>
> ><br>
> > Reported-by: Tomasz Stanislawski <<a href="mailto:t.stanislaws@samsung.com">t.stanislaws@samsung.com</a>><br>
> > Signed-off-by: Sumit Semwal <<a href="mailto:sumit.semwal@ti.com">sumit.semwal@ti.com</a>><br>
> > ---<br>
> > drivers/base/dma-buf.c | 7 +++++--<br>
> > include/linux/dma-buf.h | 8 +++++---<br>
> > 2 files changed, 10 insertions(+), 5 deletions(-)<br>
> ><br>
> > diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c<br>
> > index 8afe2dd..c9a945f 100644<br>
> > --- a/drivers/base/dma-buf.c<br>
> > +++ b/drivers/base/dma-buf.c<br>
> > @@ -271,16 +271,19 @@ EXPORT_SYMBOL_GPL(dma_buf_map_attachment);<br>
> > * dma_buf_ops.<br>
> > * @attach: [in] attachment to unmap buffer from<br>
> > * @sg_table: [in] scatterlist info of the buffer to unmap<br>
> > + * @direction: [in] direction of DMA transfer<br>
> > *<br>
> > */<br>
> > void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,<br>
> > - struct sg_table *sg_table)<br>
> > + struct sg_table *sg_table,<br>
> > + enum dma_data_direction direction)<br>
> > {<br>
> > if (WARN_ON(!attach || !attach->dmabuf || !sg_table))<br>
> > return;<br>
> ><br>
> > mutex_lock(&attach->dmabuf->lock);<br>
> > - attach->dmabuf->ops->unmap_dma_buf(attach, sg_table);<br>
> > + attach->dmabuf->ops->unmap_dma_buf(attach, sg_table,<br>
> > + direction);<br>
> > mutex_unlock(&attach->dmabuf->lock);<br>
> ><br>
> > }<br>
> > diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h<br>
> > index 86f6241..847b026 100644<br>
> > --- a/include/linux/dma-buf.h<br>
> > +++ b/include/linux/dma-buf.h<br>
> > @@ -63,7 +63,8 @@ struct dma_buf_ops {<br>
> > struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *,<br>
> > enum dma_data_direction);<br>
> > void (*unmap_dma_buf)(struct dma_buf_attachment *,<br>
> > - struct sg_table *);<br>
> > + struct sg_table *,<br>
> > + enum dma_data_direction);<br>
> > /* TODO: Add try_map_dma_buf version, to return immed with -EBUSY<br>
> > * if the call would block.<br>
> > */<br>
> > @@ -122,7 +123,8 @@ void dma_buf_put(struct dma_buf *dmabuf);<br>
> ><br>
> > struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *,<br>
> > enum dma_data_direction);<br>
> > -void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table<br>
> > *); +void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct<br>
> > sg_table *, + enum dma_data_direction);<br>
> > #else<br>
> ><br>
> > static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf<br>
> > *dmabuf, @@ -166,7 +168,7 @@ static inline struct sg_table<br>
> > *dma_buf_map_attachment( }<br>
> ><br>
> > static inline void dma_buf_unmap_attachment(struct dma_buf_attachment<br>
> > *attach, - struct sg_table *sg)<br>
> > + struct sg_table *sg, enum dma_data_direction write)<br>
><br>
> s/write/dir/ (or direction) ?<br>
><br>
:-) sure.</p>
<p>> > {<br>
> > return;<br>
> > }<br>
><br>
> --<br>
> Regards,<br>
><br>
> Laurent Pinchart<br>
Best regards,<br>
-Sumit. <br>
</p>