From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23BE4221FBD; Mon, 18 Aug 2025 02:01:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755482481; cv=none; b=juSgCvD2bUZ4aQDg/PW5G4p/KnfPTEEre5C52OwIxUk+YrwvL/feocycYCvv0SIRntOgPPXcWFwg6VrYcIh6YCIWbxstYJoQiCjVOOLZIf9nFSJiIHIXHixmpCI8jqqXPle4l1s67wFOeweIGvkeSOw9BGgq+MvPoNObhNFbeOI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755482481; c=relaxed/simple; bh=EKBZFU3AE4FMHSQLwCN6JL9rKAChLt1JY5sv1iHKm6w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gx0aKrONr6dPxsMRCAQis3qYBqPhjTmd2hvrx2uTqjIw62E1Z/3JObEKIAJ1xx5FdKez1ZeG5wgT1fVSx45Lp8BEZZV8i8G++NrQzBBHgw1nVhJnJacfKCalrTyjkMNXGtRnVCE0DSXG3jZav/xMmbc6hbvxXDxrlElApyF/MJ8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TjtZEGJa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TjtZEGJa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C42FDC16AAE; Mon, 18 Aug 2025 02:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1755482480; bh=EKBZFU3AE4FMHSQLwCN6JL9rKAChLt1JY5sv1iHKm6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TjtZEGJau5mIajsRb/B7g3oBqa5NIBZ2VgA4bM3FSkjrSC+MrWBJqBF9F/Yr5EEhl hRt1kJt3uXV7bmgnOFtBXCNfYmxOyraqkXZWZ6GwtUsxDoLwbxw7jSexvLO5dXqKZ6 2FX60Zzxk8sfYwNTqUzbq0RwsPrRJPWmHvqTGDMzh4qZEGZKA/KOvUmSrp6tgZKnNZ CLd+LMaqSegpr5cWI8UzRFxUB1gS8jk0iNq52G77Go5Be+cjWa7OdlLtWVHPbloc4u zFTl+EVh+37Gl5Sp875DbfHH4aM/cP3S1kZXAt/HyMu/do03ahrHqP01+USKmC+IVB xgywrgPq27+3g== From: "Mario Limonciello (AMD)" To: "Rafael J . Wysocki" , Bjorn Helgaas Cc: Pavel Machek , Len Brown , Greg Kroah-Hartman , Danilo Krummrich , =?UTF-8?q?Christian=20K=C3=B6nig?= , "James E . J . Bottomley" , "Martin K . Petersen" , Steven Rostedt , linux-pm@vger.kernel.org (open list:HIBERNATION (aka Software Suspend, aka swsusp)), amd-gfx@lists.freedesktop.org (open list:RADEON and AMDGPU DRM DRIVERS), dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), linux-scsi@vger.kernel.org (open list:SCSI SUBSYSTEM), linux-usb@vger.kernel.org (open list:USB SUBSYSTEM), linux-trace-kernel@vger.kernel.org (open list:TRACING), AceLan Kao , Kai-Heng Feng , Mark Pearson , =?UTF-8?q?Merthan=20Karaka=C5=9F?= , Eric Naim , "Mario Limonciello (AMD)" Subject: [PATCH v6 04/11] USB: Pass PMSG_POWEROFF event to suspend_common() for poweroff with S4 flow Date: Sun, 17 Aug 2025 21:00:54 -0500 Message-ID: <20250818020101.3619237-5-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250818020101.3619237-1-superm1@kernel.org> References: <20250818020101.3619237-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit If powering off the system with the S4 flow USB wakeup sources should be ignored. Add a new callback hcd_pci_poweroff() which will differentiate whether target state is S5 and pass PMSG_POWEROFF as the message so that suspend_common() will avoid doing wakeups. Signed-off-by: Mario Limonciello (AMD) --- v6: * Fix LKP robot issue without CONFIG_PM_SLEEP v5: * New patch v4: * https://lore.kernel.org/linux-pci/20250616175019.3471583-1-superm1@kernel.org/ Fix lkp robot issue --- drivers/usb/core/hcd-pci.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index cd223475917ef..921d1d0940016 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -531,6 +532,13 @@ static int hcd_pci_freeze(struct device *dev) return suspend_common(dev, PMSG_FREEZE); } +static int hcd_pci_poweroff(struct device *dev) +{ + if (system_state == SYSTEM_HALT || system_state == SYSTEM_POWER_OFF) + return suspend_common(dev, PMSG_POWEROFF); + return suspend_common(dev, PMSG_SUSPEND); +} + static int hcd_pci_suspend_noirq(struct device *dev) { struct pci_dev *pci_dev = to_pci_dev(dev); @@ -602,6 +610,7 @@ static int hcd_pci_restore(struct device *dev) #define hcd_pci_suspend NULL #define hcd_pci_freeze NULL #define hcd_pci_suspend_noirq NULL +#define hcd_pci_poweroff NULL #define hcd_pci_poweroff_late NULL #define hcd_pci_resume_noirq NULL #define hcd_pci_resume NULL @@ -639,7 +648,7 @@ const struct dev_pm_ops usb_hcd_pci_pm_ops = { .freeze_noirq = check_root_hub_suspended, .thaw_noirq = NULL, .thaw = hcd_pci_resume, - .poweroff = hcd_pci_suspend, + .poweroff = hcd_pci_poweroff, .poweroff_late = hcd_pci_poweroff_late, .poweroff_noirq = hcd_pci_suspend_noirq, .restore_noirq = hcd_pci_resume_noirq, -- 2.43.0