summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/ion/ion.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c
index b90c4a826260..b32b1427e3e3 100644
--- a/drivers/gpu/ion/ion.c
+++ b/drivers/gpu/ion/ion.c
@@ -1114,3 +1114,19 @@ void ion_device_destroy(struct ion_device *dev)
/* XXX need to free the heaps and clients ? */
kfree(dev);
}
+
+struct ion_client *ion_client_get_file(int fd)
+{
+ struct ion_client *client = ERR_PTR(-EFAULT);
+ struct file *f = fget(fd);
+ if (!f)
+ return ERR_PTR(-EINVAL);
+
+ if (f->f_op == &ion_fops) {
+ client = f->private_data;
+ ion_client_get(client);
+ }
+
+ fput(f);
+ return client;
+}