68feae3d486a5272a3a57f6bc8d100f04dbc0233
[openwrt/staging/adrian.git] /
1 From ad21bb0b5abf5414e31ac3e41ff60216bee52982 Mon Sep 17 00:00:00 2001
2 From: Gurchetan Singh <gurchetansingh@chromium.org>
3 Date: Mon, 2 Dec 2019 17:36:25 -0800
4 Subject: [PATCH] udmabuf: add a pointer to the miscdevice in dma-buf
5 private data
6
7 Commit c1bbed668997268c9edccdc9db1bd1487d9e20b0 upstream.
8
9 Will be used later.
10
11 v2: rename 'udmabuf_misc' to 'device' (kraxel)
12
13 Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
14 Link: http://patchwork.freedesktop.org/patch/msgid/20191203013627.85991-2-gurchetansingh@chromium.org
15 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
16 ---
17 drivers/dma-buf/udmabuf.c | 11 +++++++----
18 1 file changed, 7 insertions(+), 4 deletions(-)
19
20 --- a/drivers/dma-buf/udmabuf.c
21 +++ b/drivers/dma-buf/udmabuf.c
22 @@ -18,6 +18,7 @@ static const size_t size_limit_mb = 64;
23 struct udmabuf {
24 pgoff_t pagecount;
25 struct page **pages;
26 + struct miscdevice *device;
27 };
28
29 static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf)
30 @@ -104,8 +105,9 @@ static const struct dma_buf_ops udmabuf_
31 #define SEALS_WANTED (F_SEAL_SHRINK)
32 #define SEALS_DENIED (F_SEAL_WRITE)
33
34 -static long udmabuf_create(const struct udmabuf_create_list *head,
35 - const struct udmabuf_create_item *list)
36 +static long udmabuf_create(struct miscdevice *device,
37 + struct udmabuf_create_list *head,
38 + struct udmabuf_create_item *list)
39 {
40 DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
41 struct file *memfd = NULL;
42 @@ -172,6 +174,7 @@ static long udmabuf_create(const struct
43 exp_info.priv = ubuf;
44 exp_info.flags = O_RDWR;
45
46 + ubuf->device = device;
47 buf = dma_buf_export(&exp_info);
48 if (IS_ERR(buf)) {
49 ret = PTR_ERR(buf);
50 @@ -209,7 +212,7 @@ static long udmabuf_ioctl_create(struct
51 list.offset = create.offset;
52 list.size = create.size;
53
54 - return udmabuf_create(&head, &list);
55 + return udmabuf_create(filp->private_data, &head, &list);
56 }
57
58 static long udmabuf_ioctl_create_list(struct file *filp, unsigned long arg)
59 @@ -228,7 +231,7 @@ static long udmabuf_ioctl_create_list(st
60 if (IS_ERR(list))
61 return PTR_ERR(list);
62
63 - ret = udmabuf_create(&head, list);
64 + ret = udmabuf_create(filp->private_data, &head, list);
65 kfree(list);
66 return ret;
67 }