From 64fecf287c8ab4a540d20237c32b98301c9e80eb Mon Sep 17 00:00:00 2001 From: Maneet Singh Date: Thu, 11 Sep 2014 20:12:33 -0700 Subject: [PATCH] video: tegra: nvmap: remove support for Deprecated GET_ID/FROM_ID ioctl's Remove support and add warning message for deprecated IOCTL's - NVMAP_IOC_FROM_ID and NVMAP_IOC_GET_ID. These ioctl calls are deprecated by corresponding FD ioctl calls. Bug 1553082 Change-Id: I3cd531422293f19496687f346692fa91ebe58a40 Signed-off-by: Maneet Singh Reviewed-on: http://git-master/r/498045 (cherry picked from commit 420dce0a99231453ebbd091f110d0de816e4885e) Reviewed-on: http://git-master/r/556844 Reviewed-by: Mitch Luban Tested-by: Mitch Luban --- drivers/video/tegra/nvmap/nvmap_dev.c | 6 +-- drivers/video/tegra/nvmap/nvmap_ioctl.c | 52 ------------------------- drivers/video/tegra/nvmap/nvmap_ioctl.h | 2 - 3 files changed, 3 insertions(+), 57 deletions(-) diff --git a/drivers/video/tegra/nvmap/nvmap_dev.c b/drivers/video/tegra/nvmap/nvmap_dev.c index 006f59a7215..1324a63ed4b 100644 --- a/drivers/video/tegra/nvmap/nvmap_dev.c +++ b/drivers/video/tegra/nvmap/nvmap_dev.c @@ -571,14 +571,14 @@ static long nvmap_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) switch (cmd) { case NVMAP_IOC_CREATE: - case NVMAP_IOC_FROM_ID: case NVMAP_IOC_FROM_FD: err = nvmap_ioctl_create(filp, cmd, uarg); break; + case NVMAP_IOC_FROM_ID: case NVMAP_IOC_GET_ID: - err = nvmap_ioctl_getid(filp, uarg); - break; + pr_warn_once("nvmap: unsupported FROM_ID/GET_ID IOCTLs used.\n"); + return -ENOTTY; case NVMAP_IOC_GET_FD: err = nvmap_ioctl_getfd(filp, uarg); diff --git a/drivers/video/tegra/nvmap/nvmap_ioctl.c b/drivers/video/tegra/nvmap/nvmap_ioctl.c index 4e70335cadd..ab3c4522aaa 100644 --- a/drivers/video/tegra/nvmap/nvmap_ioctl.c +++ b/drivers/video/tegra/nvmap/nvmap_ioctl.c @@ -59,34 +59,6 @@ struct nvmap_handle *unmarshal_user_handle(__u32 handle) return 0; } -/* - * marshal_id/unmarshal_id are for get_id/handle_from_id. - * These are added to support using Fd's for handle. - */ -#ifdef CONFIG_ARM64 -static __u32 marshal_id(struct nvmap_handle *handle) -{ - return (__u32)((uintptr_t)handle >> 2); -} - -static struct nvmap_handle *unmarshal_id(__u32 id) -{ - uintptr_t h = ((id << 2) | PAGE_OFFSET); - - return (struct nvmap_handle *)h; -} -#else -static __u32 marshal_id(struct nvmap_handle *handle) -{ - return (uintptr_t)handle; -} - -static struct nvmap_handle *unmarshal_id(__u32 id) -{ - return (struct nvmap_handle *)id; -} -#endif - struct nvmap_handle *__nvmap_ref_to_id(struct nvmap_handle_ref *ref) { if (!virt_addr_valid(ref)) @@ -235,28 +207,6 @@ out: return err; } -int nvmap_ioctl_getid(struct file *filp, void __user *arg) -{ - struct nvmap_client *client = filp->private_data; - struct nvmap_create_handle op; - struct nvmap_handle *h = NULL; - - if (copy_from_user(&op, arg, sizeof(op))) - return -EFAULT; - - h = unmarshal_user_handle(op.handle); - if (!h) - return -EINVAL; - - op.id = marshal_id(h); - if (client == h->owner) - h->global = true; - - nvmap_handle_put(h); - - return copy_to_user(arg, &op, sizeof(op)) ? -EFAULT : 0; -} - static int nvmap_share_release(struct inode *inode, struct file *file) { struct nvmap_handle *h = file->private_data; @@ -403,8 +353,6 @@ int nvmap_ioctl_create(struct file *filp, unsigned int cmd, void __user *arg) ref = nvmap_create_handle(client, PAGE_ALIGN(op.size)); if (!IS_ERR(ref)) ref->handle->orig_size = op.size; - } else if (cmd == NVMAP_IOC_FROM_ID) { - ref = nvmap_duplicate_handle(client, unmarshal_id(op.id), 0); } else if (cmd == NVMAP_IOC_FROM_FD) { ref = nvmap_create_handle_from_fd(client, op.fd); } else { diff --git a/drivers/video/tegra/nvmap/nvmap_ioctl.h b/drivers/video/tegra/nvmap/nvmap_ioctl.h index 84d087d25fc..e0b0739db18 100644 --- a/drivers/video/tegra/nvmap/nvmap_ioctl.h +++ b/drivers/video/tegra/nvmap/nvmap_ioctl.h @@ -60,8 +60,6 @@ int nvmap_ioctl_pinop(struct file *filp, bool is_pin, void __user *arg, int nvmap_ioctl_get_param(struct file *filp, void __user *arg, bool is32); -int nvmap_ioctl_getid(struct file *filp, void __user *arg); - int nvmap_ioctl_getfd(struct file *filp, void __user *arg); int nvmap_ioctl_alloc(struct file *filp, void __user *arg); -- 2.39.2