[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <875xdaevab.wl-tiwai@suse.de>
Date: Mon, 22 Sep 2025 10:38:52 +0200
From: Takashi Iwai <tiwai@...e.de>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Linux PM <linux-pm@...r.kernel.org>,
Takashi Iwai <tiwai@...e.de>,
LKML <linux-kernel@...r.kernel.org>,
Linux PCI <linux-pci@...r.kernel.org>,
Alex Williamson <alex.williamson@...hat.com>,
Bjorn Helgaas <helgaas@...nel.org>,
Zhang Qilong <zhangqilong3@...wei.com>,
Ulf Hansson <ulf.hansson@...aro.org>
Subject: Re: [PATCH v2 1/3] PM: runtime: Add auto-cleanup macros for "resume and get" operations
On Sat, 20 Sep 2025 12:54:58 +0200,
Rafael J. Wysocki wrote:
>
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>
> It is generally useful to be able to automatically drop a device's
> runtime PM usage counter incremented by runtime PM operations that
> resume a device and bump up its usage counter [1].
>
> To that end, add DEFINE_CLASS() macros allowing pm_runtime_put()
> and pm_runtime_put_autosuspend() to be used for the auto-cleanup in
> those cases.
>
> Simply put, a piece of code like below:
>
> pm_runtime_get_sync(dev);
> .....
> pm_runtime_put(dev);
> return 0;
>
> can be transformed with CLASS() like:
>
> CLASS(pm_runtime_get_active, pm)(dev);
> if (IS_ERR(pm))
> return PTR_ERR(pm);
> .....
> return 0;
>
> (note the new resume error handling).
Do we still allow the code without the error check even using CLASS()?
Although the error check should be handled, it's not mandatory for
now. That said, the above example could be still in a form like:
CLASS(pm_runtime_get_active, pm)(dev);
.....
return 0;
while adding the proper error check is recommended?
thanks,
Takashi
Powered by blists - more mailing lists