summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVevek Venkatesan <vevekv@codeaurora.org>2018-02-19 16:45:50 +0530
committerVevek Venkatesan <vevekv@codeaurora.org>2018-02-22 18:52:12 +0530
commitaef3e2691823d9de46c2f3c40a627303a05d8d61 (patch)
tree09e2b0918c52975c32ca99a30ce22f11166c019d
parent795ffc9a3bc48767ead6569b14077757e552031f (diff)
input: misc: hbtp_input: fix list corruption in completion queue
Fix list corruption in task completion wait queue, in hbtp_input driver. Change-Id: Ic9967a196a575ce8aaad62a85ecbf055cf66a6f0 Signed-off-by: Vevek Venkatesan <vevekv@codeaurora.org>
-rw-r--r--drivers/input/misc/hbtp_input.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/input/misc/hbtp_input.c b/drivers/input/misc/hbtp_input.c
index f85556079d12..9a4b07c8cf60 100644
--- a/drivers/input/misc/hbtp_input.c
+++ b/drivers/input/misc/hbtp_input.c
@@ -1,5 +1,5 @@
-/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -89,6 +89,7 @@ struct hbtp_data {
u32 power_on_delay;
u32 power_off_delay;
bool manage_pin_ctrl;
+ bool init_completion_done_once;
s16 ROI[MAX_ROI_SIZE];
s16 accelBuffer[MAX_ACCEL_SIZE];
};
@@ -815,8 +816,14 @@ static long hbtp_input_ioctl_handler(struct file *file, unsigned int cmd,
return -EFAULT;
}
mutex_lock(&hbtp->mutex);
- init_completion(&hbtp->power_resume_sig);
- init_completion(&hbtp->power_suspend_sig);
+ if (hbtp->init_completion_done_once) {
+ reinit_completion(&hbtp->power_resume_sig);
+ reinit_completion(&hbtp->power_suspend_sig);
+ } else {
+ init_completion(&hbtp->power_resume_sig);
+ init_completion(&hbtp->power_suspend_sig);
+ hbtp->init_completion_done_once = true;
+ }
hbtp->power_sig_enabled = true;
mutex_unlock(&hbtp->mutex);
pr_err("%s: sync_signal option is enabled\n", __func__);
@@ -1523,6 +1530,7 @@ static int __init hbtp_init(void)
mutex_init(&hbtp->mutex);
mutex_init(&hbtp->sensormutex);
+ hbtp->init_completion_done_once = false;
error = misc_register(&hbtp_input_misc);
if (error) {