diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-07-17 16:44:00 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-08-03 19:41:20 +0200 |
commit | b45ae32bd027d7b7a65cc50ce5484446077f2648 (patch) | |
tree | 02d9698f8257c7b6a816493301c51e993c6d1d0b /drivers | |
parent | staging:iio:adis16260: Add value range check for calibscale/-bias (diff) | |
download | linux-b45ae32bd027d7b7a65cc50ce5484446077f2648.tar.xz linux-b45ae32bd027d7b7a65cc50ce5484446077f2648.zip |
staging:iio:adis16260: Use sign_extend32() instead of open-coding it
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/iio/gyro/adis16260_core.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c index 55e67959b054..f060452f367e 100644 --- a/drivers/staging/iio/gyro/adis16260_core.c +++ b/drivers/staging/iio/gyro/adis16260_core.c @@ -277,9 +277,7 @@ static int adis16260_read_raw(struct iio_dev *indio_dev, mutex_unlock(&indio_dev->mlock); return ret; } - val16 &= (1 << bits) - 1; - val16 = (s16)(val16 << (16 - bits)) >> (16 - bits); - *val = val16; + *val = sign_extend32(val16, bits - 1); mutex_unlock(&indio_dev->mlock); return IIO_VAL_INT; case IIO_CHAN_INFO_CALIBSCALE: |