linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: "Mario Limonciello (AMD) (kernel.org)" <superm1@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 v9 4/4] USB: Pass PMSG_POWEROFF event to suspend_common()
Date: Mon, 3 Nov 2025 21:38:11 +0100	[thread overview]
Message-ID: <CAJZ5v0iH4rvRPB5XVgTKV-9aKimYOM5NkjskCTUX31eyoB0_eQ@mail.gmail.com> (raw)
In-Reply-To: <06cd1b43-e765-4597-9f61-5058c8a13425@kernel.org>

On Mon, Nov 3, 2025 at 9:10 PM Mario Limonciello (AMD) (kernel.org)
<superm1@kernel.org> wrote:
>
>
>
> On 11/3/2025 2:09 PM, Rafael J. Wysocki wrote:
> > On Sun, Oct 26, 2025 at 6:09 AM Mario Limonciello (AMD)
> > <superm1@kernel.org> wrote:
> >>
> >> 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,
> >> --
> >
> > I would defer this patch until you know what exactly suspend_common()
> > will do for PMSG_POWEROFF because it may just be simpler to check
> > system_state == SYSTEM_POWER_OFF in it internally.
>
> OK - in that case would you just take the first 3 for 6.19?

I still need to go through them once again, but overall that's the plan.

      reply	other threads:[~2025-11-03 20:38 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 ` [PATCH v9 4/4] USB: Pass PMSG_POWEROFF event to suspend_common() Mario Limonciello (AMD)
2025-11-03 20:09   ` Rafael J. Wysocki
2025-11-03 20:10     ` Mario Limonciello (AMD) (kernel.org)
2025-11-03 20:38       ` Rafael J. Wysocki [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=CAJZ5v0iH4rvRPB5XVgTKV-9aKimYOM5NkjskCTUX31eyoB0_eQ@mail.gmail.com \
    --to=rafael@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=superm1@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).