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) <supe...@kernel.org> --- v6: * Fix LKP robot issue without CONFIG_PM_SLEEP v5: * New patch v4: * https://lore.kernel.org/linux-pci/20250616175019.3471583-1-supe...@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 <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> +#include <linux/pm.h> #include <linux/usb.h> #include <linux/usb/hcd.h> @@ -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