From 4a15e35dbfd2bc14b6fe9a2a0bf8a33f624182e5 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/538987 GVS: Gerrit_Virtual_Submit Reviewed-by: Winnie Hsu --- drivers/video/tegra/nvmap/nvmap_dev.c | 6 ++-- drivers/video/tegra/nvmap/nvmap_ioctl.c | 48 ------------------------- drivers/video/tegra/nvmap/nvmap_ioctl.h | 2 -- 3 files changed, 3 insertions(+), 53 deletions(-) diff --git a/drivers/video/tegra/nvmap/nvmap_dev.c b/drivers/video/tegra/nvmap/nvmap_dev.c index 1c27e36c190..d90fc4a417b 100644 --- a/drivers/video/tegra/nvmap/nvmap_dev.c +++ b/drivers/video/tegra/nvmap/nvmap_dev.c @@ -516,14 +516,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 a71322b76f2..850afd1ff43 100644 --- a/drivers/video/tegra/nvmap/nvmap_ioctl.c +++ b/drivers/video/tegra/nvmap/nvmap_ioctl.c @@ -60,34 +60,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)) @@ -233,24 +205,6 @@ out: return err; } -int nvmap_ioctl_getid(struct file *filp, void __user *arg) -{ - 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); - 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; @@ -391,8 +345,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 a0379b064c2..6c051fe6457 100644 --- a/drivers/video/tegra/nvmap/nvmap_ioctl.h +++ b/drivers/video/tegra/nvmap/nvmap_ioctl.h @@ -30,8 +30,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