[PATCH] dmabuf: allow exporter to define customs ioctls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In addition of the already existing operations allow exporter
to use it own custom ioctls.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@xxxxxxxxxx>
---
 drivers/dma-buf/dma-buf.c | 3 +++
 include/linux/dma-buf.h   | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 9810d1d..6abd129 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -291,6 +291,9 @@ static long dma_buf_ioctl(struct file *file,
 
 		return 0;
 	default:
+		if (dmabuf->ops->ioctl)
+			return dmabuf->ops->ioctl(dmabuf, cmd, arg);
+
 		return -ENOTTY;
 	}
 }
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index 532108e..b6f9837 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -70,6 +70,9 @@ struct dma_buf_attachment;
  * @vmap: [optional] creates a virtual mapping for the buffer into kernel
  *	  address space. Same restrictions as for vmap and friends apply.
  * @vunmap: [optional] unmaps a vmap from the buffer
+ * @ioctl: [optional] ioctls supported by the exporter.
+ *	   It is up to the exporter to do the proper copy_{from/to}_user
+ *	   calls. Should return -EINVAL in case of error.
  */
 struct dma_buf_ops {
 	int (*attach)(struct dma_buf *, struct device *,
@@ -104,6 +107,8 @@ struct dma_buf_ops {
 
 	void *(*vmap)(struct dma_buf *);
 	void (*vunmap)(struct dma_buf *, void *vaddr);
+
+	int (*ioctl)(struct dma_buf *, unsigned int cmd, unsigned long arg);
 };
 
 /**
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux