From: "Mario Limonciello (AMD) (kernel.org)" <superm1@kernel.org>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Danilo Krummrich" <dakr@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Pavel Machek" <pavel@kernel.org>, "Len Brown" <lenb@kernel.org>,
"Christian König" <christian.koenig@amd.com>,
"open list:HIBERNATION (aka Software Suspend,
aka swsusp)" <linux-pm@vger.kernel.org>,
"open list:SCSI SUBSYSTEM" <linux-scsi@vger.kernel.org>,
"open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>,
"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>
Subject: Re: [PATCH v8 4/4] USB: Pass PMSG_POWEROFF event to suspend_common()
Date: Thu, 18 Sep 2025 16:01:21 -0500 [thread overview]
Message-ID: <e36f6832-16e3-4aac-a1b9-02b51ab11e2a@kernel.org> (raw)
In-Reply-To: <20250918195509.GA1918371@bhelgaas>
On 9/18/2025 2:55 PM, Bjorn Helgaas wrote:
> On Wed, Sep 17, 2025 at 10:44:27PM -0500, Mario Limonciello (AMD) wrote:
>> suspend_common() passes the a PM message indicating what type of event
>> is occurring. Add a new callback hcd_pci_poweroff() which will
>> determine if target state is power off and pass PMSG_POWEROFF as the
>> message.
>
> Something is missing in "passes the a".
A wild 'a' appeared.
>
>> There are no functional changes in this patch.
>
> Maybe so, but the .poweroff() path previously called
> "suspend_common(dev, PMSG_SUSPEND)" and now may call
> "suspend_common(dev, PMSG_POWEROFF)", so it's not completely obvious
> that this is a functional no-op.
>
> It seems sort of weird that apparently we can call .poweroff() for
> either a "suspend" or a "power-off" event.
>
It's actually either a hibernate or a power off event. The nomenclature
can be a bit confusing.
I'll add a comment to the top of the function to explain it.
> Maybe it would be helpful to explain how we get to .poweroff() when
> system_state is something other than SYSTEM_POWER_OFF, and what that
> means?
Well right now it's not a possible path, but per Rafael's guidance of
splitting the series into 3 parts across 3 cycles the path that leads
here won't exist for a while. It was just plumbing.
I'll adjust the commit message to allude to the future.
>
>> +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.51.0
>>
prev parent reply other threads:[~2025-09-18 21:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 3:44 [PATCH v8 0/4] Introduce and plumb PMSG_POWEROFF Mario Limonciello (AMD)
2025-09-18 3:44 ` [PATCH v8 1/4] PM: Introduce new PMSG_POWEROFF event Mario Limonciello (AMD)
2025-09-18 19:57 ` Bjorn Helgaas
2025-09-18 3:44 ` [PATCH v8 2/4] scsi: Add PM_EVENT_POWEROFF into suspend callbacks Mario Limonciello (AMD)
2025-09-18 19:57 ` Bjorn Helgaas
2025-09-18 3:44 ` [PATCH v8 3/4] usb: sl811-hcd: " Mario Limonciello (AMD)
2025-09-18 3:44 ` [PATCH v8 4/4] USB: Pass PMSG_POWEROFF event to suspend_common() Mario Limonciello (AMD)
2025-09-18 19:55 ` Bjorn Helgaas
2025-09-18 21:01 ` Mario Limonciello (AMD) (kernel.org) [this message]
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=e36f6832-16e3-4aac-a1b9-02b51ab11e2a@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=helgaas@kernel.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).