public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tobias Jordan <Tobias.Jordan@elektrobit.com>
To: Nicholas Mc Guire <der.herr@hofr.at>
Cc: <linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Wolfram Sang <wsa@the-dreams.de>
Subject: Re: [SIL2review] [PATCH] i2c: img-scb: fix PM device usage count
Date: Sun, 25 Feb 2018 17:27:30 +0100	[thread overview]
Message-ID: <20180225172730.2b443978@denkmatte> (raw)
In-Reply-To: <20180225132014.GA8844@osadl.at>

Hi!

On Sun, 25 Feb 2018 13:20:14 +0000 Nicholas Mc Guire wrote:

> the decrement though is conditional:
>   pm_runtime_put_noidle
>   -> atomic_add_unless(&dev->power.usage_count, -1, 0);  

pm_runtime_put_noidle is playing it safe by not decrementing past 0, I
think that's a good thing.

> Also just wondering - could one not decrement in pm_runtime_get_sync
> on the error path rather than defering this to the caller and fixing
> it there ?

That's what I've asked linux-pm in the linked discussion:

> > https://marc.info/?l=linux-pm&m=151904483924999&w=2

As far as I've understood the idea is that most "error" return values
actually are a result of disabled runtime PM, and that should be
transparent to the caller. Looking at the code, that's what the vast
majority of callers do - they just ignore the return value of
pm_runtime_get_sync, and somewhere later have an
unconditional pm_runtime_put_... call.

So the only issue are callers that don't ignore the pm_runtime_get_sync
return value, probably because they're having some kind of special
requirements for error handling. For those, they need to ensure that a
proper _put_ is done somewhere in the error path.

> Reviewed-by: Nicholas Mc Guire <der.herr@hofr.at>

Thanks for the review!,

Tobias

  reply	other threads:[~2018-02-25 16:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-24 22:43 [PATCH] i2c: img-scb: fix PM device usage count Tobias Jordan
2018-02-25 13:20 ` [SIL2review] " Nicholas Mc Guire
2018-02-25 16:27   ` Tobias Jordan [this message]
2018-04-16 16:18     ` Wolfram Sang
2018-04-17  8:03       ` Tobias.Jordan

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=20180225172730.2b443978@denkmatte \
    --to=tobias.jordan@elektrobit.com \
    --cc=der.herr@hofr.at \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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