From: Jonathan Cameron <jic23@kernel.org>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: Re: [PATCH] iio: accel: bmc150: Always restore device to normal mode after suspend-resume
Date: Sat, 15 Jul 2017 12:39:42 +0100 [thread overview]
Message-ID: <20170715123942.5d9186a0@kernel.org> (raw)
In-Reply-To: <20170713131341.7585-1-hdegoede@redhat.com>
On Thu, 13 Jul 2017 15:13:41 +0200
Hans de Goede <hdegoede@redhat.com> wrote:
> After probe we would put the device in normal mode, after a runtime
> suspend-resume we would put it back in normal mode. But for a regular
> suspend-resume we would only put it back in normal mode if triggers
> or events have been requested. This is not consistent and breaks
> reading raw values after a suspend-resume.
>
> This commit changes the regular resume path to also unconditionally put
> the device back in normal mode, fixing reading of raw values not working
> after a regular suspend-resume cycle.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Looks right to me, but I'd like to send this for stable so would
like a second opinion, say from Srinivas as the original author.
Other comments obviously welcome as well!
> ---
> drivers/iio/accel/bmc150-accel-core.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
> index 6b5d3be283c4..807299dd45eb 100644
> --- a/drivers/iio/accel/bmc150-accel-core.c
> +++ b/drivers/iio/accel/bmc150-accel-core.c
> @@ -193,7 +193,6 @@ struct bmc150_accel_data {
> struct regmap *regmap;
> int irq;
> struct bmc150_accel_interrupt interrupts[BMC150_ACCEL_INTERRUPTS];
> - atomic_t active_intr;
> struct bmc150_accel_trigger triggers[BMC150_ACCEL_TRIGGERS];
> struct mutex mutex;
> u8 fifo_mode, watermark;
> @@ -493,11 +492,6 @@ static int bmc150_accel_set_interrupt(struct bmc150_accel_data *data, int i,
> goto out_fix_power_state;
> }
>
> - if (state)
> - atomic_inc(&data->active_intr);
> - else
> - atomic_dec(&data->active_intr);
> -
> return 0;
>
> out_fix_power_state:
> @@ -1710,8 +1704,7 @@ static int bmc150_accel_resume(struct device *dev)
> struct bmc150_accel_data *data = iio_priv(indio_dev);
>
> mutex_lock(&data->mutex);
> - if (atomic_read(&data->active_intr))
> - bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_NORMAL, 0);
> + bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_NORMAL, 0);
> bmc150_accel_fifo_set_mode(data);
> mutex_unlock(&data->mutex);
>
next prev parent reply other threads:[~2017-07-15 11:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-13 13:13 [PATCH] iio: accel: bmc150: Always restore device to normal mode after suspend-resume Hans de Goede
2017-07-15 11:39 ` Jonathan Cameron [this message]
2017-07-17 19:50 ` Srinivas Pandruvada
2017-07-17 20:41 ` 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=20170715123942.5d9186a0@kernel.org \
--to=jic23@kernel.org \
--cc=hdegoede@redhat.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=srinivas.pandruvada@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;
as well as URLs for NNTP newsgroup(s).