Re: [PATCH v1 0/3] PM: runtime: Wrapper macros for usage counter guards

Jonathan Cameron
2025-11-10T12:06:55Z

On Fri, 07 Nov 2025 19:35:09 +0100
"Rafael J. Wysocki" <rafael@kernel.org> wrote:

> Hi All,
>
> The runtime PM usage counter guards introduced recently:
>
> https://lore.kernel.org/linux-pm/6196611.lOV4Wx5bFT@rafael.j.wysocki/
>
> and then fixed:
>
> https://lore.kernel.org/linux-pm/5943878.DvuYhMxLoT@rafael.j.wysocki/
>
> should generally work, but using them feels sort of arcane and cryptic
> even though the underlying concept is relatively straightforward.
>
> For this reason, runtime PM wrapper macros around ACQUIRE() and
> ACQUIRE_ERR() involving the new guards are introduced in this series
> (patch [1/3]) and then used in the code already using the guards (patches
> [2/3] and [3/3]) to make it look more straightforward.
>
> Thanks!

It's an interesting trade off between completely hiding the magic variables
and verbosity. The PM_RUNTIME_ACQUIRE_ERR smells like something we'd
expect to be using global state (given no parameters), but it is of
course just local with a magic name. Will take a little getting
used to but then so does all this cleanup.h magic. So on balance
I think this is a good change.

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>