[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0g0qJDrEvRrxEboc1Bs_9dgqpV47rFOZrJQLvOS44nAXg@mail.gmail.com>
Date: Sun, 14 Jun 2020 15:50:11 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Wolfram Sang <wsa@...nel.org>
Cc: Linux PM <linux-pm@...r.kernel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-i2c <linux-i2c@...r.kernel.org>
Subject: Re: RFC: a failing pm_runtime_get increases the refcnt?
On Sun, Jun 14, 2020 at 11:08 AM Wolfram Sang <wsa@...nel.org> wrote:
>
> Hi Linux-PM,
>
> both in the I2C subsystem and also for Renesas drivers I maintain, I am
> starting to get boilerplate patches doing some pm_runtime_put_* variant
> because a failing pm_runtime_get is supposed to increase the ref
> counters? Really?
Yes. Really.
pm_runtime_get*() have been doing this forever, because the majority
of their users do something like
pm_runtime_get*()
...
pm_runtime_put*()
without checking the return values and they don't need to worry about
the refcounts, which wouldn't be possible otherwise.
> This feels wrong and unintuitive to me. I expect there
> has been a discussion around it but I couldn't find it. I wonder why we
> don't fix the code where the incremented refcount is expected for some
> reason.
>
> Can I have some pointers please?
The behavior is actually documented in
Documentation/power/runtime_pm.rst and I'm working on kerneldoc
comments for runtime PM functions in general to make it a bit more
clear.
Cheers!
Powered by blists - more mailing lists