From: Jonathan Cameron <jic23@kernel.org>
To: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 03/10] iio: humidity: hts221: do not overwrite reserved data during power-down
Date: Sat, 12 Aug 2017 12:07:35 +0100 [thread overview]
Message-ID: <20170812120724.0f4b783e@archlinux> (raw)
In-Reply-To: <CAA2SeN+PwAomyi6+xpFVqa1MtcDnd=PWvSjZiKvi5_3K2NdZCQ@mail.gmail.com>
On Fri, 11 Aug 2017 21:54:07 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> > On Mon, 17 Jul 2017 19:38:58 +0200
> > Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> >
> >> GENMASK(6, 3) in CTRL_REG1 and GENMASK(6, 2) in CTRL_REG2 are marked
> >> reserved. Do not changed the original value (not declared in the
> >> datasheet) during power-down/suspend routines.
> >>
> >> Fixes: e4a70e3e7d84 (iio: humidity: add support to hts221 rh/temp device)
> >> Fixes: b7079eeac5da (iio: humidity: hts221: add power management support)
> >> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
> > Applied to the togreg branch of iio.git and pushed out as testing.
> >
> > If we want to do a backport of this it would be fine, but it needs
> > to require absolute minimal changes to the driver.
> >
>
> I think we need to push write_with_mask patch as well in order to fix
> that issue. What do you think?
>
> Regards,
> Lorenzo
Hmm. Is it possible to do a much more minimal local implementation
in just these two locations. That patch is rather larger than
it feels like we should need. Obviously the end result is clean,
but the process to get there is non trivial.
Jonathan
>
> > Jonathan
> >> ---
> >> drivers/iio/humidity/hts221_core.c | 10 ++++------
> >> 1 file changed, 4 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> >> index 47a29b2da1ce..6e5847386a45 100644
> >> --- a/drivers/iio/humidity/hts221_core.c
> >> +++ b/drivers/iio/humidity/hts221_core.c
> >> @@ -305,11 +305,10 @@ int hts221_power_on(struct hts221_hw *hw)
> >>
> >> int hts221_power_off(struct hts221_hw *hw)
> >> {
> >> - __le16 data = 0;
> >> int err;
> >>
> >> - err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
> >> - (u8 *)&data);
> >> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> >> + HTS221_ENABLE_MASK, false);
> >> if (err < 0)
> >> return err;
> >>
> >> @@ -692,11 +691,10 @@ static int __maybe_unused hts221_suspend(struct device *dev)
> >> {
> >> struct iio_dev *iio_dev = dev_get_drvdata(dev);
> >> struct hts221_hw *hw = iio_priv(iio_dev);
> >> - __le16 data = 0;
> >> int err;
> >>
> >> - err = hw->tf->write(hw->dev, HTS221_REG_CNTRL1_ADDR, sizeof(data),
> >> - (u8 *)&data);
> >> + err = hts221_write_with_mask(hw, HTS221_REG_CNTRL1_ADDR,
> >> + HTS221_ENABLE_MASK, false);
> >>
> >> return err < 0 ? err : 0;
> >> }
> >
>
>
>
next prev parent reply other threads:[~2017-08-12 11:13 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 17:38 [PATCH v2 00/10] hts221: add new features and fix power-off procedure Lorenzo Bianconi
2017-07-17 17:38 ` [PATCH v2 01/10] iio: humidity: hts221: refactor write_with_mask code Lorenzo Bianconi
2017-07-22 17:57 ` Jonathan Cameron
2017-07-17 17:38 ` [PATCH v2 02/10] iio: humidity: hts221: move BDU configuration in probe routine Lorenzo Bianconi
2017-07-22 17:58 ` Jonathan Cameron
2017-07-17 17:38 ` [PATCH v2 03/10] iio: humidity: hts221: do not overwrite reserved data during power-down Lorenzo Bianconi
2017-07-22 18:02 ` Jonathan Cameron
2017-08-11 19:54 ` Lorenzo Bianconi
2017-08-12 11:07 ` Jonathan Cameron [this message]
2017-08-12 16:28 ` Lorenzo Bianconi
2017-07-17 17:38 ` [PATCH v2 04/10] iio: humidity: hts221: avoid useless ODR reconfiguration Lorenzo Bianconi
2017-07-22 20:19 ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 05/10] iio: humidity: hts221: squash hts221_power_on/off in hts221_set_enable Lorenzo Bianconi
2017-07-22 20:21 ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 06/10] iio: humidity: hts221: support active-low interrupts Lorenzo Bianconi
2017-07-22 20:22 ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 07/10] dt-bindings: " Lorenzo Bianconi
2017-07-22 20:23 ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 08/10] iio: humidity: hts221: support open drain mode Lorenzo Bianconi
2017-07-22 20:25 ` Jonathan Cameron
2017-07-25 19:01 ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 09/10] dt-bindings: " Lorenzo Bianconi
2017-07-24 17:48 ` Rob Herring
2017-07-25 19:02 ` Jonathan Cameron
2017-07-17 17:39 ` [PATCH v2 10/10] iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state() Lorenzo Bianconi
2017-07-25 19:03 ` 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=20170812120724.0f4b783e@archlinux \
--to=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=lorenzo.bianconi83@gmail.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).