linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Wolfram Sang <wsa@kernel.org>
Cc: Linux PM <linux-pm@vger.kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-i2c <linux-i2c@vger.kernel.org>
Subject: Re: RFC: a failing pm_runtime_get increases the refcnt?
Date: Sun, 14 Jun 2020 15:50:11 +0200	[thread overview]
Message-ID: <CAJZ5v0g0qJDrEvRrxEboc1Bs_9dgqpV47rFOZrJQLvOS44nAXg@mail.gmail.com> (raw)
In-Reply-To: <20200614090751.GA2878@kunai>

On Sun, Jun 14, 2020 at 11:08 AM Wolfram Sang <wsa@kernel.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!

      parent reply	other threads:[~2020-06-14 13:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-14  9:07 RFC: a failing pm_runtime_get increases the refcnt? Wolfram Sang
2020-06-14  9:34 ` Andy Shevchenko
2020-06-14  9:42   ` Andy Shevchenko
2020-06-14 10:00     ` Geert Uytterhoeven
2020-06-14 10:04       ` Geert Uytterhoeven
2020-06-14 10:44         ` Andy Shevchenko
2020-06-14 12:42       ` Andy Shevchenko
2020-06-14 13:59       ` Rafael J. Wysocki
2020-06-14 14:07         ` Wolfram Sang
2020-06-30 19:48           ` Wolfram Sang
2020-06-14 13:50 ` 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=CAJZ5v0g0qJDrEvRrxEboc1Bs_9dgqpV47rFOZrJQLvOS44nAXg@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=wsa@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).