From: Linus Walleij <linus.walleij@linaro.org>
To: Dinghao Liu <dinghao.liu@zju.edu.cn>
Cc: Kangjie Lu <kjlu@umn.edu>, Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio <linux-iio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Re: [PATCH] iio: magnetometer: ak8974: Fix runtime PM imbalance on error
Date: Tue, 26 May 2020 11:31:56 +0200 [thread overview]
Message-ID: <CACRpkdYr7mprhK9rdWEfuuwb7hxxc5aS5LZqKf4x5OgMrvh4CQ@mail.gmail.com> (raw)
In-Reply-To: <58a22985.cfec2.1724f66f322.Coremail.dinghao.liu@zju.edu.cn>
On Tue, May 26, 2020 at 7:14 AM <dinghao.liu@zju.edu.cn> wrote:
> > On Sun, May 24, 2020 at 4:51 AM Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:
> > > disable_pm:
> > > - pm_runtime_put_noidle(&i2c->dev);
> > > pm_runtime_disable(&i2c->dev);
> > > ak8974_set_power(ak8974, AK8974_PWR_OFF);
> >
> > Keep the top pm_runtime_put_noidle().
>
> I found that there was already a pm_runtime_put() before
> iio_triggered_buffer_setup() (just after pm_runtime_use_autosuspend).
> So if we keep the pm_runtime_put_noidle() here, we will have
> two pmusage counter decrement. Do you think this is a bug?
Yes you're right.
What about just moving the pm_runtime_put() until the end
of the initialization? Right before return 0;
Then we can keep this nice goto exits as they are.
Maybe move all these three:
pm_runtime_set_autosuspend_delay(&i2c->dev,
AK8974_AUTOSUSPEND_DELAY);
pm_runtime_use_autosuspend(&i2c->dev);
pm_runtime_put(&i2c->dev);
Yours,
Linus Walleij
next prev parent reply other threads:[~2020-05-26 9:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-24 2:51 [PATCH] iio: magnetometer: ak8974: Fix runtime PM imbalance on error Dinghao Liu
2020-05-25 12:08 ` Linus Walleij
2020-05-26 5:14 ` dinghao.liu
2020-05-26 9:31 ` Linus Walleij [this message]
2020-05-26 10:05 ` dinghao.liu
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=CACRpkdYr7mprhK9rdWEfuuwb7hxxc5aS5LZqKf4x5OgMrvh4CQ@mail.gmail.com \
--to=linus.walleij@linaro.org \
--cc=dinghao.liu@zju.edu.cn \
--cc=jic23@kernel.org \
--cc=kjlu@umn.edu \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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).