From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B90DC433DF for ; Mon, 29 Jun 2020 20:02:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E10820675 for ; Mon, 29 Jun 2020 20:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593460964; bh=KO/JCaZ5wUrlxW2nIkFv0yXpbuWg68KCpnLN6xwhQvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=eG2LJn6bINHsb2KgXZ7bzr9ahbv/mJYKVqpYRxq/kFFnbSITwOEYAL2eEYAcwqIPM UrQlWoCxzYWCmGTobKdLzBFJY5SQd4hOnJkwLGu2neSDfBIqbzsIGt2fBwtQfTKPZj 6JvFN2eEmfll8dEPjRpuvof9WSu0t8eh0ac97zPc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733141AbgF2Tjl (ORCPT ); Mon, 29 Jun 2020 15:39:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:40594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733005AbgF2Tad (ORCPT ); Mon, 29 Jun 2020 15:30:33 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 48BA12523E; Mon, 29 Jun 2020 15:35:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593444956; bh=KO/JCaZ5wUrlxW2nIkFv0yXpbuWg68KCpnLN6xwhQvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Re8IO/IfqSRXEG7TMw7wdkmdbIqfNxu5cKoQ64ozwkTFdpvpfuMo6EAMRTq/w9UXY 25yxvj48B7ikrHsvsVTFYJfZdLSdDjEezOQ5Zgg1qFAgTh4ayA6/0ZhSU8jWR4AQOZ ezwaCEKyClTUqZ0CcHlNOlu7BKClrFYMQ9ZQ5hzk= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kai-Heng Feng , Mathias Nyman , Greg Kroah-Hartman Subject: [PATCH 4.19 055/131] xhci: Return if xHCI doesn't support LPM Date: Mon, 29 Jun 2020 11:33:46 -0400 Message-Id: <20200629153502.2494656-56-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629153502.2494656-1-sashal@kernel.org> References: <20200629153502.2494656-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.131-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.19.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.19.131-rc1 X-KernelTest-Deadline: 2020-07-01T15:34+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kai-Heng Feng commit f0c472a6da51f9fac15e80fe2fd9c83b68754cff upstream. Just return if xHCI is quirked to disable LPM. We can save some time from reading registers and doing spinlocks. Add stable tag as we want this patch together with the next one, "Poll for U0 after disabling USB2 LPM" which fixes a suspend issue for some USB2 LPM devices Cc: stable@vger.kernel.org Signed-off-by: Kai-Heng Feng Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20200624135949.22611-5-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- 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 7b8d839142da7..f8e71c7aba6e6 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4305,6 +4305,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; @@ -4327,7 +4330,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.25.1