diff mbox series

[RFC,4/6] udmabuf: add a pointer to the miscdevice in dma-buf private data

Message ID 20190801022517.1903-5-gurchetansingh@chromium.org (mailing list archive)
State New, archived
Headers show
Series udmabuf guest <--> host interaction model | expand

Commit Message

Gurchetan Singh Aug. 1, 2019, 2:25 a.m. UTC
Will be used later.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
---
 drivers/dma-buf/udmabuf.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Gerd Hoffmann Aug. 1, 2019, 6:42 a.m. UTC | #1
On Wed, Jul 31, 2019 at 07:25:15PM -0700, Gurchetan Singh wrote:
> Will be used later.
> 
> Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
> ---
>  drivers/dma-buf/udmabuf.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
> index 134e53d24c2b..47003abbf4c2 100644
> --- a/drivers/dma-buf/udmabuf.c
> +++ b/drivers/dma-buf/udmabuf.c
> @@ -19,6 +19,7 @@ struct udmabuf {
>  	u32 flags;
>  	pgoff_t pagecount;
>  	struct page **pages;
> +	struct miscdevice *udmabuf_misc;

I'd name this "dev" or "device".

cheers,
  Gerd
diff mbox series

Patch

diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 134e53d24c2b..47003abbf4c2 100644
--- a/drivers/dma-buf/udmabuf.c
+++ b/drivers/dma-buf/udmabuf.c
@@ -19,6 +19,7 @@  struct udmabuf {
 	u32 flags;
 	pgoff_t pagecount;
 	struct page **pages;
+	struct miscdevice *udmabuf_misc;
 };
 
 static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf)
@@ -128,7 +129,8 @@  static const struct dma_buf_ops udmabuf_ops = {
 #define SEALS_WANTED (F_SEAL_SHRINK)
 #define SEALS_DENIED (F_SEAL_WRITE)
 
-static long udmabuf_create(const struct udmabuf_create_list *head,
+static long udmabuf_create(struct miscdevice *udmabuf_misc,
+			   struct udmabuf_create_list *head,
 			   const struct udmabuf_create_item *list)
 {
 	DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
@@ -202,6 +204,7 @@  static long udmabuf_create(const struct udmabuf_create_list *head,
 		exp_info.flags = O_WRONLY;
 
 	ubuf->flags = head->flags;
+	ubuf->udmabuf_misc = udmabuf_misc;
 	buf = dma_buf_export(&exp_info);
 	if (IS_ERR(buf)) {
 		ret = PTR_ERR(buf);
@@ -239,7 +242,7 @@  static long udmabuf_ioctl_create(struct file *filp, unsigned long arg)
 	list.offset = create.offset;
 	list.size   = create.size;
 
-	return udmabuf_create(&head, &list);
+	return udmabuf_create(filp->private_data, &head, &list);
 }
 
 static long udmabuf_ioctl_create_list(struct file *filp, unsigned long arg)
@@ -258,7 +261,7 @@  static long udmabuf_ioctl_create_list(struct file *filp, unsigned long arg)
 	if (IS_ERR(list))
 		return PTR_ERR(list);
 
-	ret = udmabuf_create(&head, list);
+	ret = udmabuf_create(filp->private_data, &head, list);
 	kfree(list);
 	return ret;
 }