Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2552683ima; Mon, 22 Oct 2018 11:39:32 -0700 (PDT) X-Google-Smtp-Source: ACcGV60vn8DhoeizyGKXPH3FAiFgjblqmZGXUs/eHHWXi4rzUSL4NjDQVkWqL1MTjRDOmdNIFLys X-Received: by 2002:a63:2447:: with SMTP id k68-v6mr14375360pgk.156.1540233571979; Mon, 22 Oct 2018 11:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540233571; cv=none; d=google.com; s=arc-20160816; b=HgyokxVUWSUCEf095j7fNM6JWXJKSfFopwLG7rd9NWDKgNk8zKrfUnQ0iq6a+1mpi5 MM6kP1AwKkdRWBEWB27hDSrC40ZEt3jFfJiTNUVngVf2BJdrIJpP2Pn/hfrA7Xgs/ODN f1dbuCBmdfQRGEUvSLdQMdNHh5zCK+UerpnYrjarikTQ7ZTJtwcbijm7zHjQAmcyJnu1 BEpVsuEHZx9KmxdHoERNoau3V8HzfNbLnugh/7ByT/d4cAGJq9egO1UzelhyaVxsK1H2 cZJWOzxVTg7qpiCgm1w6vU7oOUt2qy32QChGPh69A7fq2fj0hjLOsem21QHut1EDv3XC R3MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from; bh=h2kUfIxR5RgdUl8WHLDbAFLod3B1o9L+YhsgCVEguZ8=; b=EhcCj8lhpyXTp9Y1Q5yPVqeDWB8qY1Ag2gsd1ZHgiyzPmlP84gpGD1mDlghyCMAxKx G5EYJISKY3IKzGUNK0cHqe9GMyKzg2xRW2X+hjvRnKroUZoNmpdOEy78tRoJXKu1Hb86 TX4px6LXl7Jzi0u/b8Bup+p9pq7ai122naNvIvUSn0DR4SLKAyFrg0LCtggOUCqGsdNO MG7y5pci/94EtC5oGFAZnERwG8gux1y85p8JB/nhAnnwHzw3YFeKkBiSS6H/f8RK2IKu hgMEwTcA20yuJEcLCzc70fALvHonPjK2sJxsvQCHH/ip21qU12WY4UI2DX5dMR3ASDLP hbXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1-v6si14107718ply.279.2018.10.22.11.39.16; Mon, 22 Oct 2018 11:39:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728892AbeJWCCm (ORCPT + 99 others); Mon, 22 Oct 2018 22:02:42 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51634 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727330AbeJWCCl (ORCPT ); Mon, 22 Oct 2018 22:02:41 -0400 Received: from [111.196.56.27] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1gEeEQ-0006T5-Pm; Mon, 22 Oct 2018 17:43:12 +0000 From: Aaron Ma To: aaron.ma@canonical.com, mathias.nyman@intel.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] usb: xhci: fix timeout for transition from RExit to U0 Date: Tue, 23 Oct 2018 01:42:47 +0800 Message-Id: <1540230167-12528-2-git-send-email-aaron.ma@canonical.com> X-Mailer: git-send-email 1.8.5.5 In-Reply-To: <1540230167-12528-1-git-send-email-aaron.ma@canonical.com> References: <1540230167-12528-1-git-send-email-aaron.ma@canonical.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This definition is used by msecs_to_jiffies in milliseconds. According to the comments, max rexit timeout should be 20ms. Align with the comments to properly calculate the delay. Verified on Sunrise Point-LP and Cannon Lake. Cc: stable@vger.kernel.org Signed-off-by: Aaron Ma --- drivers/usb/host/xhci-hub.c | 4 ++-- drivers/usb/host/xhci.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 56a08daa7431..af168ada8f86 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -920,7 +920,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, time_left = wait_for_completion_timeout( &bus_state->rexit_done[wIndex], msecs_to_jiffies( - XHCI_MAX_REXIT_TIMEOUT)); + XHCI_MAX_REXIT_TIMEOUT_MS)); spin_lock_irqsave(&xhci->lock, flags); if (time_left) { @@ -934,7 +934,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, } else { int port_status = readl(port->addr); xhci_warn(xhci, "Port resume took longer than %i msec, port status = 0x%x\n", - XHCI_MAX_REXIT_TIMEOUT, + XHCI_MAX_REXIT_TIMEOUT_MS, port_status); status |= USB_PORT_STAT_SUSPEND; clear_bit(wIndex, &bus_state->rexit_ports); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 6230a578324c..237877042262 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1678,7 +1678,7 @@ struct xhci_bus_state { * It can take up to 20 ms to transition from RExit to U0 on the * Intel Lynx Point LP xHCI host. */ -#define XHCI_MAX_REXIT_TIMEOUT (20 * 1000) +#define XHCI_MAX_REXIT_TIMEOUT_MS 20 static inline unsigned int hcd_index(struct usb_hcd *hcd) { -- 2.19.1