public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>, Takashi Iwai <tiwai@suse.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux PCI <linux-pci@vger.kernel.org>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	Zhang Qilong <zhangqilong3@huawei.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	"Dan Williams" <dan.j.williams@intel.com>
Subject: Re: [PATCH v3 2/3] PCI/sysfs: Use runtime PM class macro for auto-cleanup
Date: Fri, 26 Sep 2025 15:06:13 +0100	[thread overview]
Message-ID: <20250926150613.000073a4@huawei.com> (raw)
In-Reply-To: <20250922185036.GA1983521@bhelgaas>

On Mon, 22 Sep 2025 13:50:36 -0500
Bjorn Helgaas <helgaas@kernel.org> wrote:

> On Mon, Sep 22, 2025 at 05:31:53PM +0200, Rafael J. Wysocki wrote:
> > From: Takashi Iwai <tiwai@suse.de>
> > 
> > Use the newly introduced class macro to simplify the code.
> > 
> > Also, add the proper error handling for the PM runtime get errors.
> > 
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > Link: https://patch.msgid.link/20250919163147.4743-3-tiwai@suse.de
> > [ rjw: Adjusted the subject and the name of the class ]
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>  
> 
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Being half asleep I went and  replied to v1 when v2 and indeed this v3
were already out. Sorry about that.

Anyhow question is why not ACQUIRE() and ACQUIRE_ERR()?

original discussion on how those came about rather that direct use of
class that you have here was I think here:
https://lore.kernel.org/all/20250509104028.GL4439@noisy.programming.kicks-ass.net/

Though note, we didn't end up with the parallel universe that is talking about.

+CC Dan,

Jonathan

> 
> > ---
> > 
> > v2 -> v3: No changes
> > 
> > v1 -> v2:
> >    * Adjust the name of the class to handle the disabled runtime PM case
> >      transparently (like the original code).
> > 
> > ---
> >  drivers/pci/pci-sysfs.c |    5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > --- a/drivers/pci/pci-sysfs.c
> > +++ b/drivers/pci/pci-sysfs.c
> > @@ -1475,8 +1475,9 @@ static ssize_t reset_method_store(struct
> >  		return count;
> >  	}
> >  
> > -	pm_runtime_get_sync(dev);
> > -	struct device *pmdev __free(pm_runtime_put) = dev;
> > +	CLASS(pm_runtime_get_active, pmdev)(dev);
> > +	if (IS_ERR(pmdev))
> > +		return -ENXIO;
> >  
> >  	if (sysfs_streq(buf, "default")) {
> >  		pci_init_reset_methods(pdev);
> > 
> > 
> >   
> 


  reply	other threads:[~2025-09-26 14:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22 15:26 [PATCH v3 0/3] PM: runtime: Auto-cleanup macros for runtime PM Rafael J. Wysocki
2025-09-22 15:30 ` [PATCH v3 1/3] PM: runtime: Add auto-cleanup macros for "resume and get" operations Rafael J. Wysocki
2025-09-23  8:53   ` Dhruva Gole
2025-09-23 10:43     ` Rafael J. Wysocki
2025-09-23 10:56       ` Dhruva Gole
2025-09-23 19:51   ` Frank Li
2025-09-22 15:31 ` [PATCH v3 2/3] PCI/sysfs: Use runtime PM class macro for auto-cleanup Rafael J. Wysocki
2025-09-22 18:50   ` Bjorn Helgaas
2025-09-26 14:06     ` Jonathan Cameron [this message]
2025-09-26 14:38       ` Rafael J. Wysocki
2025-09-22 15:33 ` [PATCH v3 3/3] PM: runtime: Drop DEFINE_FREE() for pm_runtime_put() Rafael J. Wysocki
2025-09-23  8:54   ` Dhruva Gole

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=20250926150613.000073a4@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=alex.williamson@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=helgaas@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=tiwai@suse.de \
    --cc=ulf.hansson@linaro.org \
    --cc=zhangqilong3@huawei.com \
    /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