diff mbox

[07/20] usb: host: xhci: use msecs_to_jiffies() instead of HZ

Message ID 20180416122930.15697-7-felipe.balbi@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Felipe Balbi April 16, 2018, 12:29 p.m. UTC
HZ can change based on CPUFreq. We should use msecs_to_jiffies()
instead.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
---
 drivers/usb/host/xhci.c | 3 +--
 drivers/usb/host/xhci.h | 6 +++---
 2 files changed, 4 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index eec9e0c0b7c9..663eac3c8a1b 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1505,8 +1505,7 @@  static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
 			goto done;
 		}
 		ep->ep_state |= EP_STOP_CMD_PENDING;
-		ep->stop_cmd_timer.expires = jiffies +
-			XHCI_STOP_EP_CMD_TIMEOUT * HZ;
+		ep->stop_cmd_timer.expires = jiffies + XHCI_STOP_EP_CMD_TIMEOUT;
 		add_timer(&ep->stop_cmd_timer);
 		xhci_queue_stop_endpoint(xhci, command, urb->dev->slot_id,
 					 ep_index, 0);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 05c909b04f14..d2d30cbbf53d 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1518,7 +1518,7 @@  struct xhci_td {
 };
 
 /* xHCI command default timeout value */
-#define XHCI_CMD_DEFAULT_TIMEOUT	(5 * HZ)
+#define XHCI_CMD_DEFAULT_TIMEOUT	(msecs_to_jiffies(5000))
 
 /* command descriptor */
 struct xhci_cd {
@@ -1630,8 +1630,8 @@  struct urb_priv {
 #define	ERST_ENTRIES	1
 /* Poll every 60 seconds */
 #define	POLL_TIMEOUT	60
-/* Stop endpoint command timeout (secs) for URB cancellation watchdog timer */
-#define XHCI_STOP_EP_CMD_TIMEOUT	5
+/* Stop endpoint command timeout (jiffies) for URB cancellation watchdog timer */
+#define XHCI_STOP_EP_CMD_TIMEOUT	(msecs_to_jiffies(5000))
 /* XXX: Make these module parameters */
 
 struct s3_save {