aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dma-buf.h
diff options
context:
space:
mode:
authorRob Clark <rob@ti.com>2012-03-16 12:04:41 -0400
committerSumit Semwal <sumit.semwal@ti.com>2012-03-26 02:02:40 -0400
commitf9a24d1ac9cb82baf5ec5efdb6580a9ce0bd5bfc (patch)
tree6dd135509fa938eb3c9f8adab6919110a6f01f2b /include/linux/dma-buf.h
parent55c1c4ca23d0f2736ef7c219d0fb005323ff8ee0 (diff)
dma-buf: add get_dma_buf()
Works in a similar way to get_file(), and is needed in cases such as when the exporter needs to also keep a reference to the dmabuf (that is later released with a dma_buf_put()), and possibly other similar cases. Signed-off-by: Rob Clark <rob@ti.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Diffstat (limited to 'include/linux/dma-buf.h')
-rw-r--r--include/linux/dma-buf.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index 891457a86b30..bc4203dc6e18 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -30,6 +30,7 @@
30#include <linux/scatterlist.h> 30#include <linux/scatterlist.h>
31#include <linux/list.h> 31#include <linux/list.h>
32#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
33#include <linux/fs.h>
33 34
34struct dma_buf; 35struct dma_buf;
35struct dma_buf_attachment; 36struct dma_buf_attachment;
@@ -110,6 +111,20 @@ struct dma_buf_attachment {
110 void *priv; 111 void *priv;
111}; 112};
112 113
114/**
115 * get_dma_buf - convenience wrapper for get_file.
116 * @dmabuf: [in] pointer to dma_buf
117 *
118 * Increments the reference count on the dma-buf, needed in case of drivers
119 * that either need to create additional references to the dmabuf on the
120 * kernel side. For example, an exporter that needs to keep a dmabuf ptr
121 * so that subsequent exports don't create a new dmabuf.
122 */
123static inline void get_dma_buf(struct dma_buf *dmabuf)
124{
125 get_file(dmabuf->file);
126}
127
113#ifdef CONFIG_DMA_SHARED_BUFFER 128#ifdef CONFIG_DMA_SHARED_BUFFER
114struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, 129struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
115 struct device *dev); 130 struct device *dev);