Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp430907ybk; Wed, 20 May 2020 03:20:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoxnpgpn4S8xjNMXV65arqboLi1YH1g2A0zAKWOBkk14f61ogr2kLEZFQGvnzkGzhc0LG/ X-Received: by 2002:a17:906:3d69:: with SMTP id r9mr3044693ejf.20.1589970007542; Wed, 20 May 2020 03:20:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589970007; cv=none; d=google.com; s=arc-20160816; b=P64fLUlXIQssTbNn1Tne+6qUbbtToLoh6IDW19L6r0wrOZJ3JUxcE5leBcAJi7sV6q LCb0bUEsxJRwp5XbzMiwgx/NP7pmS/pTXQ/KZF2iqb4hJjL0+TTbDQPEHtT5EnduDWlj NZJwcixtstYO5ijkkMDfX4mYsq+tgbsuxr1NqcDLria7IBiYsyPSoVXcP2AMtMZg9C8i YqzNSUHcjFpPNouX1VBWyTHDkyOCaG3VS7rcaWAd+8zLsUW1b9kntcXEV6ugunxk+NzU O5oBLxH9mEutLf+FLmVeFUx61J+Xh4V1X1pGZSvnHBPAvWgSAAmHpZB7xIhV36HUKKXx q8Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=yj7c6o2Ay892jRLQ+p3Tc1RJ73SgVsfIf2y1uxPVKWA=; b=z5YrwdOXHkaaz3OdzaQQ7bmBsMLIKlEtOfz3mux9rumbRgMwagZOwY5FBLl4wH/UmU M2YzMwtt5BlBfQOIzFOG7Bbt7U3la02zbsHRLey63oj5o6QVvMl8sN1w8GsgX0h1C6AA m62LKnV8nWgczAlCWK19lKuyXEq9rv/7JQQdz7PO38LHcBD+KVHfHUFEH3M2FY1gkiRw qQZLwHl2IBDKVtwN1xrwx4ZXBE0+pE27IBv483j7Xq+UDUOHd7/soB34OaK4aWVg5HIj XDOwU97Wn9oOa1n/KlcOocHLEeo2ns7jR2no9ZVmdvcKovWzmvJU7SY1b7SJtDofEi4x OmmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id f11si243562ejb.655.2020.05.20.03.19.44; Wed, 20 May 2020 03:20:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726560AbgETKSV (ORCPT + 99 others); Wed, 20 May 2020 06:18:21 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:56491 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbgETKSU (ORCPT ); Wed, 20 May 2020 06:18:20 -0400 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jbLnl-0001Iq-Sz; Wed, 20 May 2020 10:18:18 +0000 From: Kai-Heng Feng To: mathias.nyman@intel.com Cc: Kai-Heng Feng , Greg Kroah-Hartman , linux-usb@vger.kernel.org (open list:USB XHCI DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/2] xhci: Return if xHCI doesn't support LPM Date: Wed, 20 May 2020 18:18:10 +0800 Message-Id: <20200520101811.2623-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Just return if xHCI is quirked to disable LPM. We can save some time from reading registers and doing spinlocks. Signed-off-by: Kai-Heng Feng --- drivers/usb/host/xhci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index bee5deccc83d..14181a7ea375 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4390,6 +4390,9 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, int hird, exit_latency; int ret; + if (xhci->quirks & XHCI_HW_LPM_DISABLE) + return -EPERM; + if (hcd->speed >= HCD_USB3 || !xhci->hw_lpm_support || !udev->lpm_capable) return -EPERM; @@ -4412,7 +4415,7 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, xhci_dbg(xhci, "%s port %d USB2 hardware LPM\n", enable ? "enable" : "disable", port_num + 1); - if (enable && !(xhci->quirks & XHCI_HW_LPM_DISABLE)) { + if (enable) { /* Host supports BESL timeout instead of HIRD */ if (udev->usb2_hw_lpm_besl_capable) { /* if device doesn't have a preferred BESL value use a -- 2.17.1