Commit c1bbed66 authored by Gurchetan Singh's avatar Gurchetan Singh Committed by Gerd Hoffmann

udmabuf: add a pointer to the miscdevice in dma-buf private data

Will be used later.

v2: rename 'udmabuf_misc' to 'device' (kraxel)
Signed-off-by: default avatarGurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191203013627.85991-2-gurchetansingh@chromium.orgSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent bc7a71da
...@@ -18,6 +18,7 @@ static const size_t size_limit_mb = 64; /* total dmabuf size, in megabytes */ ...@@ -18,6 +18,7 @@ static const size_t size_limit_mb = 64; /* total dmabuf size, in megabytes */
struct udmabuf { struct udmabuf {
pgoff_t pagecount; pgoff_t pagecount;
struct page **pages; struct page **pages;
struct miscdevice *device;
}; };
static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf) static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf)
...@@ -104,8 +105,9 @@ static const struct dma_buf_ops udmabuf_ops = { ...@@ -104,8 +105,9 @@ static const struct dma_buf_ops udmabuf_ops = {
#define SEALS_WANTED (F_SEAL_SHRINK) #define SEALS_WANTED (F_SEAL_SHRINK)
#define SEALS_DENIED (F_SEAL_WRITE) #define SEALS_DENIED (F_SEAL_WRITE)
static long udmabuf_create(const struct udmabuf_create_list *head, static long udmabuf_create(struct miscdevice *device,
const struct udmabuf_create_item *list) struct udmabuf_create_list *head,
struct udmabuf_create_item *list)
{ {
DEFINE_DMA_BUF_EXPORT_INFO(exp_info); DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
struct file *memfd = NULL; struct file *memfd = NULL;
...@@ -172,6 +174,7 @@ static long udmabuf_create(const struct udmabuf_create_list *head, ...@@ -172,6 +174,7 @@ static long udmabuf_create(const struct udmabuf_create_list *head,
exp_info.priv = ubuf; exp_info.priv = ubuf;
exp_info.flags = O_RDWR; exp_info.flags = O_RDWR;
ubuf->device = device;
buf = dma_buf_export(&exp_info); buf = dma_buf_export(&exp_info);
if (IS_ERR(buf)) { if (IS_ERR(buf)) {
ret = PTR_ERR(buf); ret = PTR_ERR(buf);
...@@ -209,7 +212,7 @@ static long udmabuf_ioctl_create(struct file *filp, unsigned long arg) ...@@ -209,7 +212,7 @@ static long udmabuf_ioctl_create(struct file *filp, unsigned long arg)
list.offset = create.offset; list.offset = create.offset;
list.size = create.size; 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) static long udmabuf_ioctl_create_list(struct file *filp, unsigned long arg)
...@@ -228,7 +231,7 @@ static long udmabuf_ioctl_create_list(struct file *filp, unsigned long arg) ...@@ -228,7 +231,7 @@ static long udmabuf_ioctl_create_list(struct file *filp, unsigned long arg)
if (IS_ERR(list)) if (IS_ERR(list))
return PTR_ERR(list); return PTR_ERR(list);
ret = udmabuf_create(&head, list); ret = udmabuf_create(filp->private_data, &head, list);
kfree(list); kfree(list);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment