Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp883833pxb; Tue, 3 Nov 2020 15:29:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxn/al1uyopwdAO0sv8SBN3fEbRtmiP9I+BiUOVWBs7mOpmspbEDXGnQYknVVhArrD2V/vj X-Received: by 2002:a17:906:241b:: with SMTP id z27mr21156115eja.418.1604446168797; Tue, 03 Nov 2020 15:29:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604446168; cv=none; d=google.com; s=arc-20160816; b=EeEqpLBIdhuF86Hq27yRYWtzVb2/YJo/cPTvtEb/ZLKV4b2/BLQjl1QZOEtbdA0i2Z kFpcBISMY+D/Nx0zopN1hO76Uta2OZPHzxvDSHouqpxqwSHlmq7SzG+pKz4RMsBw6tAj F4fHZN1likOkGDTDbdrFy3MaelDdCzixkDiWeoXwgD8op0HgP7areDOVdSVW7fsWQOs5 JXHuXdpFKch5VSRpgaNC1gevyp4Wp77oejYFkXsA4kEfH3tnIDpUSAyQJ3IOLbDdVovR 6r2L6xikFLFZzpLFlAYvNg5t5AwVp5CNDxxcMBUVbCGq1/SJ2iyRYnPdIByM3a3uLIVh kiTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jr1nBXeS7qQgXSE/C/xz36T6YTDkL2ft3if+jW01Zxg=; b=K7xcT7wmfd4rXe3iDhotB6NNjK282lghJv3OHMQeObMEt4jTfO1WkXzDchQnBkDiWq QPeku5BWlYtx36D9fq3eUnAPIEzOHGxYvRQtlt4VmwnmZrxo/feNxLQtwrm3mvVrHdJc I1eXKfzTZEgw5jioEZHGbpMuS4bmOVLvlG2BJ7CBA3CA8AWR4gmbWihrKXJ9JLpkSau4 dU37S22K1fop8SRXRpVvhcFvcOlhMmcdHdBuGTBEyMIPINPISyPy9W10P8/Dci17JbSx QAj6AT7f3pTXIXah/+TfyucEZviYsfqJUsN20spwUruQfXhmxn/hHy3Q0LUpRp3mSjbg HvMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1LMsSnTQ; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k18si261288ejh.32.2020.11.03.15.29.05; Tue, 03 Nov 2020 15:29:28 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=1LMsSnTQ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730585AbgKCWFw (ORCPT + 99 others); Tue, 3 Nov 2020 17:05:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:54398 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730459AbgKCUmQ (ORCPT ); Tue, 3 Nov 2020 15:42:16 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 53711223AC; Tue, 3 Nov 2020 20:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436135; bh=XGsbqvd62qY1W8D7D05w1F7bqDnJdi/VHCcbnNG8Ces=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1LMsSnTQQF+6SHWf3DTD35xb2dfye2+mecu/aeap3XxU2OJzwZ6vkyTzy5LIfXGLf nxNNKYQoVlyYEHG72dSfqy6pYqE0K9X08jwF2LZs4yaBn7p8Ny1Gym7hXpjQxZ6Dqg ryQ5z+MxF55dliu9HLZmAobouS8iK9BcudVQ+pIc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jun Li , Peter Chen , Mathias Nyman , Sasha Levin Subject: [PATCH 5.9 118/391] usb: xhci: omit duplicate actions when suspending a runtime suspended host. Date: Tue, 3 Nov 2020 21:32:49 +0100 Message-Id: <20201103203354.785713773@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203348.153465465@linuxfoundation.org> References: <20201103203348.153465465@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Chen [ Upstream commit 18a367e8947d72dd91b6fc401e88a2952c6363f7 ] If the xhci-plat.c is the platform driver, after the runtime pm is enabled, the xhci_suspend is called if nothing is connected on the port. When the system goes to suspend, it will call xhci_suspend again if USB wakeup is enabled. Since the runtime suspend wakeup setting is not always the same as system suspend wakeup setting, eg, at runtime suspend we always need wakeup if the controller is in low power mode; but at system suspend, we may not need wakeup. So, we move the judgement after changing wakeup setting. [commit message rewording -Mathias] Reviewed-by: Jun Li Signed-off-by: Peter Chen Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20200918131752.16488-8-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index e534f524b7f87..e88f4f9539955 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -982,12 +982,15 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) xhci->shared_hcd->state != HC_STATE_SUSPENDED) return -EINVAL; - xhci_dbc_suspend(xhci); - /* Clear root port wake on bits if wakeup not allowed. */ if (!do_wakeup) xhci_disable_port_wake_on_bits(xhci); + if (!HCD_HW_ACCESSIBLE(hcd)) + return 0; + + xhci_dbc_suspend(xhci); + /* Don't poll the roothubs on bus suspend. */ xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); -- 2.27.0