All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dma-buf: add get_dma_buf()
@ 2012-03-16 16:04 Rob Clark
  2012-03-16 17:53 ` [Linaro-mm-sig] " Dave Airlie
  2012-05-22 13:47 ` Tomasz Stanislawski
  0 siblings, 2 replies; 14+ messages in thread
From: Rob Clark @ 2012-03-16 16:04 UTC (permalink / raw)
  To: linaro-mm-sig, dri-devel, linux-media
  Cc: patches, sumit.semwal, daniel, airlied, Rob Clark

From: Rob Clark <rob@ti.com>

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>
---
 include/linux/dma-buf.h |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index cbdff81..25eb287 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -132,6 +132,20 @@ struct dma_buf_attachment {
 	void *priv;
 };
 
+/**
+ * get_dma_buf - convenience wrapper for get_file.
+ * @dmabuf:	[in]	pointer to dma_buf
+ *
+ * Increments the reference count on the dma-buf, needed in case of drivers
+ * that either need to create additional references to the dmabuf on the
+ * kernel side.  For example, an exporter that needs to keep a dmabuf ptr
+ * so that subsequent exports don't create a new dmabuf.
+ */
+static inline void get_dma_buf(struct dma_buf *dmabuf)
+{
+	get_file(dmabuf->file);
+}
+
 #ifdef CONFIG_DMA_SHARED_BUFFER
 struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
 							struct device *dev);
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [PATCH] dma-buf: add get_dma_buf()
@ 2012-03-16 20:02 ` Rob Clark
  0 siblings, 0 replies; 14+ messages in thread
From: Rob Clark @ 2012-03-16 20:02 UTC (permalink / raw)
  To: linaro-mm-sig, dri-devel, linux-media
  Cc: airlied, Rob Clark, sumit.semwal, patches

From: Rob Clark <rob@ti.com>

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>
---
Minor update on original to add a missing #include

 include/linux/dma-buf.h |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index 891457a..bc4203dc 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -30,6 +30,7 @@
 #include <linux/scatterlist.h>
 #include <linux/list.h>
 #include <linux/dma-mapping.h>
+#include <linux/fs.h>
 
 struct dma_buf;
 struct dma_buf_attachment;
@@ -110,6 +111,20 @@ struct dma_buf_attachment {
 	void *priv;
 };
 
+/**
+ * get_dma_buf - convenience wrapper for get_file.
+ * @dmabuf:	[in]	pointer to dma_buf
+ *
+ * Increments the reference count on the dma-buf, needed in case of drivers
+ * that either need to create additional references to the dmabuf on the
+ * kernel side.  For example, an exporter that needs to keep a dmabuf ptr
+ * so that subsequent exports don't create a new dmabuf.
+ */
+static inline void get_dma_buf(struct dma_buf *dmabuf)
+{
+	get_file(dmabuf->file);
+}
+
 #ifdef CONFIG_DMA_SHARED_BUFFER
 struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
 							struct device *dev);
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-05-22 17:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16 16:04 [PATCH] dma-buf: add get_dma_buf() Rob Clark
2012-03-16 17:53 ` [Linaro-mm-sig] " Dave Airlie
2012-03-18  7:42   ` Sumit Semwal
2012-03-18 19:04     ` Daniel Vetter
2012-03-18 19:15       ` Daniel Vetter
2012-03-18 19:15         ` Daniel Vetter
2012-05-22 13:47 ` Tomasz Stanislawski
2012-05-22 14:32   ` Daniel Vetter
2012-05-22 15:00     ` Tomasz Stanislawski
2012-05-22 15:05       ` Daniel Vetter
2012-05-22 15:13         ` Dave Airlie
2012-05-22 17:37           ` Rob Clark
  -- strict thread matches above, loose matches on Subject: below --
2012-03-16 20:02 Rob Clark
2012-03-16 20:02 ` Rob Clark

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.