diff mbox

[3/3] hid: intel-ish-hid: ipc: use msleep_interrupt() for wait

Message ID 1478828433-31779-1-git-send-email-even.xu@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Xu, Even Nov. 11, 2016, 1:40 a.m. UTC
set_current_task() must be called before schedule_timeout(), for this
driver, in order to avoid incorrect usage, use msleep_interrupt()
instead.

Signed-off-by: Even Xu <even.xu@intel.com>
---
 drivers/hid/intel-ish-hid/ipc/ipc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jiri Kosina Nov. 15, 2016, 1:27 p.m. UTC | #1
On Fri, 11 Nov 2016, Even Xu wrote:

> set_current_task() must be called before schedule_timeout(), for this
> driver, in order to avoid incorrect usage, use msleep_interrupt()
> instead.
> 
> Signed-off-by: Even Xu <even.xu@intel.com>

Is this fixing a bug that has been observed / reported in a real life, or 
has this been found purely via code inspection? (asking to schedule 
upstream merge properly).

Thanks,
Xu, Even Nov. 15, 2016, 2:37 p.m. UTC | #2
Hi, Jiri,

This issue was found by code inspection, no real bug was reported.
Thanks!

Best Regards,
Even Xu

-----Original Message-----
From: Jiri Kosina [mailto:jikos@kernel.org] 
Sent: Tuesday, November 15, 2016 9:27 PM
To: Xu, Even <even.xu@intel.com>
Cc: linux-input@vger.kernel.org; Pandruvada, Srinivas <srinivas.pandruvada@intel.com>
Subject: Re: [PATCH 3/3] hid: intel-ish-hid: ipc: use msleep_interrupt() for wait

On Fri, 11 Nov 2016, Even Xu wrote:

> set_current_task() must be called before schedule_timeout(), for this 
> driver, in order to avoid incorrect usage, use msleep_interrupt() 
> instead.
> 
> Signed-off-by: Even Xu <even.xu@intel.com>

Is this fixing a bug that has been observed / reported in a real life, or has this been found purely via code inspection? (asking to schedule upstream merge properly).

Thanks,

--
Jiri Kosina
SUSE Labs

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c
index 8194c35..86a36eb 100644
--- a/drivers/hid/intel-ish-hid/ipc/ipc.c
+++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
@@ -539,6 +539,8 @@  static int ish_fw_reset_handler(struct ishtp_device *dev)
 	return	0;
 }
 
+#define TIMEOUT_FOR_HW_RDY_MS			300
+
 /**
  * ish_fw_reset_work_fn() - FW reset worker function
  * @unused: not used
@@ -552,7 +554,7 @@  static void fw_reset_work_fn(struct work_struct *unused)
 	rv = ish_fw_reset_handler(ishtp_dev);
 	if (!rv) {
 		/* ISH is ILUP & ISHTP-ready. Restart ISHTP */
-		schedule_timeout(HZ / 3);
+		msleep_interruptible(TIMEOUT_FOR_HW_RDY_MS);
 		ishtp_dev->recvd_hw_ready = 1;
 		wake_up_interruptible(&ishtp_dev->wait_hw_ready);