From b2d7291e1852d20113faf0af93ec003f6c29a539 Mon Sep 17 00:00:00 2001 From: chenjing Date: Thu, 20 May 2021 15:39:14 +0800 Subject: [PATCH] fix: rewrite to make code clearer. Close #I3S5W4 Change-Id: I7cd7ecc3ee6408f4c5bd90e8d93dde9e956cefcd --- model/input/driver/hdf_input_device_manager.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/model/input/driver/hdf_input_device_manager.c b/model/input/driver/hdf_input_device_manager.c index f0b0b37a8..ef2d4a913 100644 --- a/model/input/driver/hdf_input_device_manager.c +++ b/model/input/driver/hdf_input_device_manager.c @@ -35,7 +35,8 @@ uint32_t TouchPoll(struct file *filep, InputDevice *inputDev, poll_table *wait); static int32_t InputDevIoctl(struct file *filep, int32_t cmd, unsigned long arg) { int32_t ret; - InputDevice *inputdev = (InputDevice *)((struct drv_data*)filep->f_vnode->data)->priv; + struct drv_data *drvData = (struct drv_data *)filep->f_vnode->data; + InputDevice *inputdev = (InputDevice *)drvData->priv; if (inputdev == NULL) { return HDF_FAILURE; } @@ -54,7 +55,8 @@ static int32_t InputDevIoctl(struct file *filep, int32_t cmd, unsigned long arg) static int32_t InputDevOpen(struct file *filep) { - InputDevice *inputdev = (InputDevice *)((struct drv_data*)filep->f_vnode->data)->priv; + struct drv_data *drvData = (struct drv_data *)filep->f_vnode->data; + InputDevice *inputdev = (InputDevice *)drvData->priv; if (inputdev == NULL) { HDF_LOGE("%s: filep is null", __func__); return HDF_FAILURE; @@ -64,7 +66,8 @@ static int32_t InputDevOpen(struct file *filep) static int32_t InputDevClose(struct file *filep) { - InputDevice *inputdev = (InputDevice *)((struct drv_data*)filep->f_vnode->data)->priv; + struct drv_data *drvData = (struct drv_data *)filep->f_vnode->data; + InputDevice *inputdev = (InputDevice *)drvData->priv; if (inputdev == NULL) { HDF_LOGE("%s: inputdev is null", __func__); return HDF_FAILURE; @@ -76,7 +79,8 @@ static int32_t InputDevClose(struct file *filep) static int32_t InputDevPoll(struct file *filep, poll_table *wait) { uint32_t pollMask = 0; - InputDevice *inputdev = (InputDevice *)((struct drv_data*)filep->f_vnode->data)->priv; + struct drv_data *drvData = (struct drv_data *)filep->f_vnode->data; + InputDevice *inputdev = (InputDevice *)drvData->priv; switch (inputdev->devType) { case INDEV_TYPE_TOUCH: pollMask = TouchPoll(filep, inputdev, wait); -- Gitee