summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorKrishna Reddy <vdumpa@nvidia.com>2011-12-29 11:18:44 -0800
committerKrishna Reddy <vdumpa@nvidia.com>2011-12-29 15:25:49 -0800
commite3763055fa85f6e815d1cd8c26cb4453bf0869a7 (patch)
treee81c27307eb7641f46cda87808d8038d60394176 /drivers/gpu
parent8d853a5ab4f1583c1e310af57b8957b8dbdb55d5 (diff)
gpu: ion: Add api to get client from file id.
Change-Id: Ifb3bc3d7fa54cddda7e3f0acd34dbcc4b1ed39d3 Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/72644 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Aleksandr Frid <afrid@nvidia.com>
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;
+}