The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] xhci: correct the usage of USB_CTRL_SET_TIMEOUT
@ 2013-10-09  1:25 Xiao Jin
  2013-10-09 20:33 ` Sarah Sharp
  0 siblings, 1 reply; 2+ messages in thread
From: Xiao Jin @ 2013-10-09  1:25 UTC (permalink / raw)
  To: sarah.a.sharp, gregkh, linux-usb, linux-kernel, akpm, mingo,
	a.p.zijlstra, rusty, william.douglas, sboyd, jslaby

From: xiao jin <jin.xiao@intel.com>
Date: Wed, 9 Oct 2013 09:09:46 +0800
Subject: [PATCH] xhci: correct the usage of USB_CTRL_SET_TIMEOUT

The usage of USB_CTRL_SET_TIMEOUT is incorrect. The
definition of USB_CTRL_SET_TIMEOUT is 5000ms. The
input timeout to wait_for_completion_interruptible_timeout
is jiffies. That makes the timeout be longer than what
we want, such as 50s in some platform.

The patch is to convert USB_CTRL_SET_TIMEOUT to jiffies as
command completion event timeout.

Signed-off-by: xiao jin <jin.xiao@intel.com>
---
 drivers/usb/host/xhci-hub.c |    2 +-
 drivers/usb/host/xhci.c     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 1d35459..78cf294 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -295,7 +295,7 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
 	/* Wait for last stop endpoint command to finish */
 	timeleft = wait_for_completion_interruptible_timeout(
 			cmd->completion,
-			USB_CTRL_SET_TIMEOUT);
+			msecs_to_jiffies(USB_CTRL_SET_TIMEOUT));
 	if (timeleft <= 0) {
 		xhci_warn(xhci, "%s while waiting for stop endpoint command\n",
 				timeleft == 0 ? "Timeout" : "Signal");
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 9478caa..f9ebc72 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3486,7 +3486,7 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
 	/* Wait for the Reset Device command to finish */
 	timeleft = wait_for_completion_interruptible_timeout(
 			reset_device_cmd->completion,
-			USB_CTRL_SET_TIMEOUT);
+			msecs_to_jiffies(USB_CTRL_SET_TIMEOUT));
 	if (timeleft <= 0) {
 		xhci_warn(xhci, "%s while waiting for reset device command\n",
 				timeleft == 0 ? "Timeout" : "Signal");
-- 
1.7.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-09 20:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-09  1:25 [PATCH] xhci: correct the usage of USB_CTRL_SET_TIMEOUT Xiao Jin
2013-10-09 20:33 ` Sarah Sharp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox