From patchwork Mon Apr 16 12:29:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 10342875 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E1F1460548 for ; Mon, 16 Apr 2018 12:30:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D46FA286C8 for ; Mon, 16 Apr 2018 12:30:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D33E0286D7; Mon, 16 Apr 2018 12:30:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7105B28710 for ; Mon, 16 Apr 2018 12:30:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754608AbeDPMan (ORCPT ); Mon, 16 Apr 2018 08:30:43 -0400 Received: from mga12.intel.com ([192.55.52.136]:16280 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754318AbeDPMal (ORCPT ); Mon, 16 Apr 2018 08:30:41 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Apr 2018 05:30:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,459,1517904000"; d="scan'208";a="32343921" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.68.37]) by fmsmga007.fm.intel.com with ESMTP; 16 Apr 2018 05:30:40 -0700 From: Felipe Balbi To: Mathias Nyman Cc: Linux USB , Felipe Balbi Subject: [PATCH 07/20] usb: host: xhci: use msecs_to_jiffies() instead of HZ Date: Mon, 16 Apr 2018 15:29:17 +0300 Message-Id: <20180416122930.15697-7-felipe.balbi@linux.intel.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180416122930.15697-1-felipe.balbi@linux.intel.com> References: <20180416122930.15697-1-felipe.balbi@linux.intel.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP HZ can change based on CPUFreq. We should use msecs_to_jiffies() instead. Signed-off-by: Felipe Balbi --- drivers/usb/host/xhci.c | 3 +-- drivers/usb/host/xhci.h | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) 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 {