Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp871888pxx; Tue, 27 Oct 2020 02:34:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5TFbeyBk8WNvZi0ujRBswUc4C8Zy5nI2SZqB7WRoH+c27giDosIJgbzw4GPVUbj9Bb0ZG X-Received: by 2002:a17:906:b010:: with SMTP id v16mr1521815ejy.163.1603791241369; Tue, 27 Oct 2020 02:34:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603791241; cv=none; d=google.com; s=arc-20160816; b=rEm6pADT2v0Wao8Ht/g+SKYfD27IMKGoa0ocRuifP6WHrtdeI9M9Yi1ewQnLBOBNwl JZnMO1r18T4SCeUg8SYtRgnIszml5xaeFqrgUvFw4TfATfcW0YqNcFB2HEi55vD2wk63 3w762NBYNinUbcXcjb/52ZApLpVFk+SFPd/bkx6UfWCYyy2XX9PBcK2itWwxcpQ3jOdj yitCL3SLwP2wAdCOsruonMv/IJ7oRvNFIJEuBOpOhYT8T9G7EW9ztKkEocegrziWeEoy /X4NzRmi6fLDZhkTbwUP6qfT2LAGjCZnyTsTOE3L+2uElIw/9nXdiIFeAx0MIXSrMOyM eTRw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7h4hjQ/eS6s2g0dcwfIlqKWLiYtTivwQ8kFF/sQwq5U=; b=GLvqCLDJn+BLQPfIDqf99SNYn1bqjykpIjjT8gcaLoR0HlsiOWvPP8JtcsFGok5ESW k9PR5pyBPKxHeXfiUezemMmuyg0D44R0JNam2eViLAJdGKS/Rk2C9pGx907Lrl3h56ek 7PutshixMQoTlyqUTpS1onj6VSHdsOiYmMSerTQ5OX/rFp+x9kK0zRO225k/P59FtHUB rzjeXxs/ratiP0OPhmZPANRb24f+hRn1LH6R6q5seiNQxrKLkXGukCEXRoGdnea2+3Yw GMteedAo0g31+qIXOix+Sa6tLKdLswc1stseHCeIs9hqOJLrt/WIKh9/IJPbHQXE56q0 Iv+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RKHv3nsP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e12si599005ejr.549.2020.10.27.02.33.39; Tue, 27 Oct 2020 02:34:01 -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; dkim=pass header.i=@kernel.org header.s=default header.b=RKHv3nsP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2409346AbgJZXvO (ORCPT + 99 others); Mon, 26 Oct 2020 19:51:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:50466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409172AbgJZXum (ORCPT ); Mon, 26 Oct 2020 19:50:42 -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 444F320882; Mon, 26 Oct 2020 23:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756242; bh=LEOzesVKSbDDx512NULGkFfnLWlkMR5U4KXl2lzpGSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RKHv3nsPpheBYMXp0+Q1umftxh3vBeSMEPFzeSDjqZHGRZNUWsGO9WLmuMM3OZ4qd G4BkK1uXI3hQnykoJm5rpoxY7VZMmjhb2ZLWZn7B2g85JH1uxFZLr9JqXlc6np0x3L 4r0SawbOtBHdc1vKgPPvixwafpz3wk9nWhqrWcCs= 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.9 078/147] usb: xhci: omit duplicate actions when suspending a runtime suspended host. Date: Mon, 26 Oct 2020 19:47:56 -0400 Message-Id: <20201026234905.1022767-78-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026234905.1022767-1-sashal@kernel.org> References: <20201026234905.1022767-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 f4cedcaee14b3..4cfb95104c26b 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