From: Brian Norris <briannorris@chromium.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Pavel Machek <pavel@kernel.org>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
kunit-dev@googlegroups.com, Len Brown <lenb@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] PM: runtime: Add basic kunit tests for API contracts
Date: Thu, 25 Sep 2025 11:36:15 -0700 [thread overview]
Message-ID: <aNWLnxtxS1tqiqbC@google.com> (raw)
In-Reply-To: <CAJZ5v0i0_r_=rsPzLmST7cZtGjHCP73t9aoXdVFa81J9nJmzsQ@mail.gmail.com>
On Wed, Sep 24, 2025 at 07:34:31PM +0200, Rafael J. Wysocki wrote:
> On Wed, Sep 24, 2025 at 7:32 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> > On Tue, Sep 23, 2025 at 11:51 PM Brian Norris <briannorris@chromium.org> wrote:
> > > On Fri, Sep 19, 2025 at 06:58:50PM +0200, Rafael J. Wysocki wrote:
> > > > Yeah, so I'd prefer to change this particular thing entirely,
> > > > especially in the face of
> > > >
> > > > https://lore.kernel.org/linux-pm/5049058.31r3eYUQgx@rafael.j.wysocki/
> > > >
> > > > which quite obviously doesn't take the return value of
> > > > pm_runtime_put() and pm_runtime_put_sutosuspend() into account.
> > > >
> > > > I would like these two functions to be void.
> > >
> > > Sure, I think inspecting put() return codes is generally a bad idea.
> > > 'void' would be cool with me, although maybe a bit impractical now,
> > > considering how many users look at the current return code.
> >
> > For pm_runtime_put() it's not that bad. I have ~20 patches changing
> > all of the code looking at its return value to stop doing that.
> >
> > Interestingly enough, there's only one piece of that code (USB core)
> > doing anything remotely useful with that return value. Everything
> > else is just garbage IMV.
> >
> > > So at a minimum, I'd separate "make 'em void" from my "document and test the
> > > API" work.
> >
> > But you can just skip them.
> >
> > > Really, I'm mostly looking at this area because I have to support driver
> > > developers trying to learn how to use the runtime PM API, and they
> > > wonder about the return codes. So if they exist, I'd at least like them
> > > to make sense.
> >
> > Sure.
> >
> > That said, as far as pm_runtime_put() and pm_runtime_put_autosuspend()
> > are concerned, you may as well just say "discard their return values,
> > you don't want to have to deal with them, and never ever pass them
> > verbatim to the callers of your code".
Sounds reasonable.
I'll drop any unit test expectations for pm_runtime_put() and
pm_runtime_put_autosuspend() return codes. But I'll leave
pm_runtime_put_sync().
> > > Anyway, for the particulars of this test: I can try to adapt the comment
> > > language a bit. But are you suggesting I shouldn't even try patch 2,
> > > which fixes the pm_runtime_put() return codes?
> >
> > Not really.
> >
> > > > Of course, there are existing users that check their return values,
> > > > but I'm not sure how much of a real advantage from doing that is.
> >
> > Well, see above. :-)
> >
> > > At least some of those users appear to not exactly know what they are
> > > doing.
> >
> > Almost none of them do nonsense.
>
> s/none/all/ (sorry)
Ha, thanks for the clarification :)
Brian
prev parent reply other threads:[~2025-09-25 18:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-29 0:28 Brian Norris
2025-08-29 0:28 ` [PATCH 2/3] PM: runtime: Make put{,_sync}() return 1 when already suspended Brian Norris
2025-09-02 7:25 ` Sakari Ailus
2025-09-05 17:42 ` Rafael J. Wysocki
2025-09-24 9:48 ` Dhruva Gole
2025-08-29 0:28 ` [PATCH 3/3] PM: runtime: Update kerneldoc return codes Brian Norris
2025-09-02 7:18 ` Sakari Ailus
2025-09-05 17:54 ` Rafael J. Wysocki
2025-09-05 17:37 ` [PATCH 1/3] PM: runtime: Add basic kunit tests for API contracts Rafael J. Wysocki
2025-09-10 20:44 ` Brian Norris
2025-09-19 16:58 ` Rafael J. Wysocki
2025-09-23 21:51 ` Brian Norris
2025-09-24 17:32 ` Rafael J. Wysocki
2025-09-24 17:34 ` Rafael J. Wysocki
2025-09-25 18:36 ` Brian Norris [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=aNWLnxtxS1tqiqbC@google.com \
--to=briannorris@chromium.org \
--cc=kunit-dev@googlegroups.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=sakari.ailus@linux.intel.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
all inboxes | Powered by JetHome®