Revert "Add implementation of poll() to dma_buf using KDS"
[cascardo/linux.git] / include / linux / dma-buf.h
index eb48f38..34073f6 100644 (file)
@@ -30,6 +30,9 @@
 #include <linux/list.h>
 #include <linux/dma-mapping.h>
 #include <linux/fs.h>
+#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
+#include <linux/kds.h>
+#endif
 
 struct device;
 struct dma_buf;
@@ -121,6 +124,9 @@ struct dma_buf {
        const struct dma_buf_ops *ops;
        /* mutex to serialize list manipulation and attach/detach */
        struct mutex lock;
+#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
+       struct kds_resource kds;
+#endif
        void *priv;
 };
 
@@ -156,6 +162,23 @@ static inline void get_dma_buf(struct dma_buf *dmabuf)
        get_file(dmabuf->file);
 }
 
+#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
+/**
+ * get_dma_buf_kds_resource - get a KDS resource for this dma-buf
+ * @dmabuf:    [in]    pointer to dma_buf
+ *
+ * Returns a KDS resource that represents the dma-buf. This should be used by
+ * drivers to synchronize access to the buffer. Note that the caller should
+ * ensure that a reference to the dma-buf exists from the call to
+ * kds_async_wait until kds_resource_set_release is called.
+ */
+static inline struct kds_resource *
+       get_dma_buf_kds_resource(struct dma_buf *dmabuf)
+{
+       return &dmabuf->kds;
+}
+#endif
+
 #ifdef CONFIG_DMA_SHARED_BUFFER
 struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
                                                        struct device *dev);