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=-13.1 required=3.0 tests=BAYES_00,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=ham 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 131A0C4363A for ; Tue, 27 Oct 2020 00:27:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE8CB20780 for ; Tue, 27 Oct 2020 00:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603758440; bh=nT2c/Q/PM+/m5zxBW6nVKOptJ7stdp+EJfyQhD0VcaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=z7NMJdsv5moqI812HtBr47TgPsBA9dvVpQEg5yEv9l2jI765wcSqYtLuyItPhWuC3 YN8CBgsCzNrSaWp6fBrngAGmnWK3jUwa9RE7+9eQDr3VE4jehGAtq4W9tIfycmaZ+R 1MpiASFL4hEpYBGEZx/vifq3VI7U43vV1K7o7FTI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2410196AbgJ0A1S (ORCPT ); Mon, 26 Oct 2020 20:27:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:58096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410110AbgJZXxd (ORCPT ); Mon, 26 Oct 2020 19:53: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 DB6F921D7B; Mon, 26 Oct 2020 23:53:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756412; bh=nT2c/Q/PM+/m5zxBW6nVKOptJ7stdp+EJfyQhD0VcaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TZbgLnOD2t7wUzBYXH01v382ff+W9HNU7gU56qn8R0uO0VyXlK3NfKHYyXycGgd95 Pi5z/RbOnxEZ0/Yv63rhCG3c3pqBTOx76FymNN8s1Dy7cOZE6IzfbrjEe9OnvqOz7b qTUuxLW/GBnDJE+hvAS+yJZuO8kIOmdFiwcWzkNI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Chen , Jun Li , Mathias Nyman , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 5.8 070/132] usb: xhci: omit duplicate actions when suspending a runtime suspended host. Date: Mon, 26 Oct 2020 19:51:02 -0400 Message-Id: <20201026235205.1023962-70-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026235205.1023962-1-sashal@kernel.org> References: <20201026235205.1023962-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 113ab5d3cbfe5..d1a63715ed250 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.25.1