From f28e440e5435514b1eda19cbadfb12f4816f1290 Mon Sep 17 00:00:00 2001 From: Randy Li Date: Thu, 21 Mar 2019 14:21:02 +0800 Subject: [PATCH] video: rockchip: vpu: fix the client type configure The userspace would use the client type ioctl to make a session work in secure mode, reuse the undefine bits of the argument. This patch would remove the secure mode setting from the client type argument which was a mistake in a previous commit, but without the secure mode applied, nobody would know. Change-Id: Ifaa976a0c9ab0c981b1f94f4978cd13a61adb0a7 Signed-off-by: Randy Li --- drivers/video/rockchip/vcodec/vcodec_service.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/video/rockchip/vcodec/vcodec_service.c b/drivers/video/rockchip/vcodec/vcodec_service.c index fcf7a043f7b9..a485c2437f17 100644 --- a/drivers/video/rockchip/vcodec/vcodec_service.c +++ b/drivers/video/rockchip/vcodec/vcodec_service.c @@ -1725,11 +1725,10 @@ static long vpu_service_ioctl(struct file *filp, unsigned int cmd, case VPU_IOC_SET_CLIENT_TYPE: { int secure_mode; - secure_mode = (arg & 0xffff0000) >> 16; - session->type = (enum VPU_CLIENT_TYPE)(arg & 0xffff); + secure_mode = arg >> 16; atomic_set(&pservice->secure_mode, secure_mode); - session->type = (enum VPU_CLIENT_TYPE)arg; + session->type = (enum VPU_CLIENT_TYPE)(arg & 0xffff); vpu_debug(DEBUG_IOCTL, "pid %d set client type %d, secure mode = %d\n", session->pid, session->type, secure_mode); } break; @@ -1793,7 +1792,7 @@ static long vpu_service_ioctl(struct file *filp, unsigned int cmd, vpu_debug(DEBUG_IOCTL, "pid %d get reg type %d\n", session->pid, session->type); - if (atomic_read(&pservice->secure_mode) == 1) { + if (atomic_read(&pservice->secure_mode)) { ret = wait_event_timeout(session->wait, pservice->secure_isr, VPU_TIMEOUT_DELAY);