From: "Mario Limonciello (AMD)" <superm1@kernel.org>
To: "Rafael J . Wysocki" <rafael@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Danilo Krummrich <dakr@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>
Cc: "Pavel Machek" <pavel@kernel.org>, "Len Brown" <lenb@kernel.org>,
"Christian König" <christian.koenig@amd.com>,
linux-pm@vger.kernel.org (open list:HIBERNATION (aka Software
Suspend, aka swsusp)),
linux-scsi@vger.kernel.org (open list:SCSI SUBSYSTEM),
linux-usb@vger.kernel.org (open list:USB SUBSYSTEM),
"AceLan Kao" <acelan.kao@canonical.com>,
"Kai-Heng Feng" <kaihengf@nvidia.com>,
"Mark Pearson" <mpearson-lenovo@squebb.ca>,
"Merthan Karakaş" <m3rthn.k@gmail.com>,
"Eric Naim" <dnaim@cachyos.org>,
"Guilherme G . Piccoli" <gpiccoli@igalia.com>,
"Mario Limonciello (AMD)" <superm1@kernel.org>
Subject: [PATCH v9 4/4] USB: Pass PMSG_POWEROFF event to suspend_common()
Date: Sun, 26 Oct 2025 00:09:05 -0500 [thread overview]
Message-ID: <20251026050905.764203-5-superm1@kernel.org> (raw)
In-Reply-To: <20251026050905.764203-1-superm1@kernel.org>
suspend_common() passes a PM message indicating what type of event
is occurring. PMSG_POWEROFF is intended to be used when hibernate
callbacks were utilized for turning off the system.
Add a new callback hcd_pci_poweroff() which will
determine if target state is power off and pass PMSG_POWEROFF as the
message.
suspend_common() doesn't do any special handling with this case at
the moment, so there are no functional changes in this patch.
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
v9:
* Reword commit message (Bjorn)
v8:
* Drop SYSTEM_HALT case
v7:
* Reword commit mesasge
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/
---
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..959baccfb07d1 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_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
next prev parent reply other threads:[~2025-10-26 5:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-26 5:09 [PATCH v9 0/4] Introduce and plumb PMSG_POWEROFF Mario Limonciello (AMD)
2025-10-26 5:09 ` [PATCH v9 1/4] PM: Introduce new PMSG_POWEROFF event Mario Limonciello (AMD)
2025-11-07 20:21 ` Rafael J. Wysocki
2025-10-26 5:09 ` [PATCH v9 2/4] scsi: Add PM_EVENT_POWEROFF into suspend callbacks Mario Limonciello (AMD)
2025-10-26 5:09 ` [PATCH v9 3/4] usb: sl811-hcd: " Mario Limonciello (AMD)
2025-10-26 5:09 ` Mario Limonciello (AMD) [this message]
2025-11-03 20:09 ` [PATCH v9 4/4] USB: Pass PMSG_POWEROFF event to suspend_common() Rafael J. Wysocki
2025-11-03 20:10 ` Mario Limonciello (AMD) (kernel.org)
2025-11-03 20:38 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251026050905.764203-5-superm1@kernel.org \
--to=superm1@kernel.org \
--cc=acelan.kao@canonical.com \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=dakr@kernel.org \
--cc=dnaim@cachyos.org \
--cc=gpiccoli@igalia.com \
--cc=gregkh@linuxfoundation.org \
--cc=kaihengf@nvidia.com \
--cc=lenb@kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=m3rthn.k@gmail.com \
--cc=mpearson-lenovo@squebb.ca \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).