diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-01-31 14:27:00 +0000 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-02-02 09:20:56 +0000 |
commit | c62b89c713ebd5e4a67c9b9229591adab8953a3c (patch) | |
tree | 82c993afa7364bd28184948dc24f16e2c51bb826 /drivers/staging/iio | |
parent | 1a87e4fba63cd82d74f23b6e0b75ad6b01b15774 (diff) | |
download | op-kernel-dev-c62b89c713ebd5e4a67c9b9229591adab8953a3c.zip op-kernel-dev-c62b89c713ebd5e4a67c9b9229591adab8953a3c.tar.gz |
staging:iio:adxrs450: Perform sign extension for the calibbias register
The calibbias (DNC) register contains a 10-bit twos complement value. Perform a
proper sign extension when reading the register, otherwise negative will
incorrectly be displayed as large positive values.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r-- | drivers/staging/iio/gyro/adxrs450_core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/iio/gyro/adxrs450_core.c b/drivers/staging/iio/gyro/adxrs450_core.c index 91a2fae..4c462d3 100644 --- a/drivers/staging/iio/gyro/adxrs450_core.c +++ b/drivers/staging/iio/gyro/adxrs450_core.c @@ -326,7 +326,7 @@ static int adxrs450_read_raw(struct iio_dev *indio_dev, ret = adxrs450_spi_read_reg_16(indio_dev, ADXRS450_DNC1, &t); if (ret) break; - *val = t; + *val = sign_extend32(t, 9); ret = IIO_VAL_INT; break; default: |