diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-07-26 17:20:48 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-08-15 22:30:04 +0100 |
commit | b82217e73b5aa6db8453ad91b929ca2366e47184 (patch) | |
tree | ef72a3d5f48264f465d4315b83850d9724c6785a /drivers/iio/pressure | |
parent | 65f79b501030678393eae0ae03d60a8151fbef55 (diff) | |
download | linux-stable-b82217e73b5aa6db8453ad91b929ca2366e47184.tar.gz linux-stable-b82217e73b5aa6db8453ad91b929ca2366e47184.tar.bz2 linux-stable-b82217e73b5aa6db8453ad91b929ca2366e47184.zip |
iio: pressure: dlhl60d: Don't take garbage into consideration when reading data
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>
Link: https://lore.kernel.org/r/20220726142048.4494-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/pressure')
-rw-r--r-- | drivers/iio/pressure/dlhl60d.c | 5 |
1 files 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; } |