All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tomislav Denis <tomislav.denis@avl.com>,
	Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: [PATCH v1 1/1] iio: pressure: dlhl60d: Don't take garbage into consideration when reading data
Date: Sun, 14 Aug 2022 18:15:14 +0100	[thread overview]
Message-ID: <20220814181514.3fe1107c@jic23-huawei> (raw)
In-Reply-To: <20220731133357.5705df25@jic23-huawei>

On Sun, 31 Jul 2022 13:33:57 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Tue, 26 Jul 2022 17:20:48 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > Both pressure and temperature are 24-bit long. Use proper accessors
> > instead of overlapping readings.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>  
> Looks correct to me, but it made me scratch my head just enough that I'd
> like Tomislav to take a look if possible.  So give me a poke if this
> hasn't progressed in a few weeks time.

Long enough.

Applied to the togreg branch of iio.git and pushed out as testing.

Thanks,

Jonathan

> 
> Thanks,
> 
> Jonathan
> 
> > ---
> >  drivers/iio/pressure/dlhl60d.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/iio/pressure/dlhl60d.c b/drivers/iio/pressure/dlhl60d.c
> > index 5f6bb3603a8b..f0b0d198c6d4 100644
> > --- a/drivers/iio/pressure/dlhl60d.c
> > +++ b/drivers/iio/pressure/dlhl60d.c
> > @@ -129,9 +129,8 @@ static int dlh_read_direct(struct dlh_state *st,
> >  	if (ret)
> >  		return ret;
> >  
> > -	*pressure = get_unaligned_be32(&st->rx_buf[1]) >> 8;
> > -	*temperature = get_unaligned_be32(&st->rx_buf[3]) &
> > -		GENMASK(DLH_NUM_TEMP_BITS - 1, 0);
> > +	*pressure = get_unaligned_be24(&st->rx_buf[1]);
> > +	*temperature = get_unaligned_be24(&st->rx_buf[4]);
> >  
> >  	return 0;
> >  }  
> 


      reply	other threads:[~2022-08-14 17:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26 14:20 [PATCH v1 1/1] iio: pressure: dlhl60d: Don't take garbage into consideration when reading data Andy Shevchenko
2022-07-31 12:33 ` Jonathan Cameron
2022-08-14 17:15   ` Jonathan Cameron [this message]

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=20220814181514.3fe1107c@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomislav.denis@avl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.