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