linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Cc: linux-iio <linux-iio@vger.kernel.org>,
	Jonathan Cameron <jic23@kernel.org>
Subject: Re: [PATCH] iio: imu: inv_mpu6050: fix suspend/resume with runtime power
Date: Tue, 31 Mar 2020 20:29:19 +0300	[thread overview]
Message-ID: <CAHp75VcSrej_dXeKBXXoVBg-3scUHrZuwRDrdB0Qy4vOGHbLag@mail.gmail.com> (raw)
In-Reply-To: <20200331133850.23757-1-jmaneyrol@invensense.com>

On Tue, Mar 31, 2020 at 4:39 PM Jean-Baptiste Maneyrol
<jmaneyrol@invensense.com> wrote:
>
> Suspend/resume were not working correctly with pm runtime.
> Now suspend check if the chip is already suspended, and
> resume put runtime pm in the correct state.
>
> Fixes: 4599cac84614 ("iio: imu: inv_mpu6050: use runtime pm with autosuspend")
> Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>

> +       st->suspended_sensors = 0;
> +       if (pm_runtime_suspended(dev)) {
> +               result = 0;
> +               goto out_unlock;
> +       }

AFAIK this is not enough to guarantee that device *will be* suspended.
That said, in one thread you may get device in the middle of RPM
suspend, while here you are checking if it's okay or not, but after in
the other thread you will get an error and roll back to the resumed
state.

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2020-03-31 17:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31 13:38 [PATCH] iio: imu: inv_mpu6050: fix suspend/resume with runtime power Jean-Baptiste Maneyrol
2020-03-31 17:29 ` Andy Shevchenko [this message]
2020-03-31 19:46   ` Jean-Baptiste Maneyrol
2020-03-31 21:54     ` Andy Shevchenko
2020-04-05 13:15 ` Jonathan Cameron
2020-04-06  7:33   ` Jean-Baptiste Maneyrol
2020-04-12 11:13     ` Jonathan Cameron

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=CAHp75VcSrej_dXeKBXXoVBg-3scUHrZuwRDrdB0Qy4vOGHbLag@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=jmaneyrol@invensense.com \
    --cc=linux-iio@vger.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).