diff options
author | Rodrigo Ribeiro <rodrigorsdc@gmail.com> | 2019-08-13 22:31:01 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2019-08-18 22:12:52 +0300 |
commit | b311da85f7944a98fdc45c2fc92d74234e22995c (patch) | |
tree | bb5bef6509275e676fcd3a5a70ae8f2a1ee87dcf /drivers/staging/iio | |
parent | 62ed7a81ef81b501a0ef3ecda532a34c6b4deb9b (diff) | |
download | linux-b311da85f7944a98fdc45c2fc92d74234e22995c.tar.xz |
staging: iio: accel: adis16240: Improve readability on write_raw function
Replace shift and minus operation by GENMASK macro and remove the local
variables used to store intermediate data.
Signed-off-by: Rodrigo Ribeiro Carvalho <rodrigorsdc@gmail.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r-- | drivers/staging/iio/accel/adis16240.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/staging/iio/accel/adis16240.c b/drivers/staging/iio/accel/adis16240.c index 62f4b3b1b457..82099db4bf0c 100644 --- a/drivers/staging/iio/accel/adis16240.c +++ b/drivers/staging/iio/accel/adis16240.c @@ -309,15 +309,12 @@ static int adis16240_write_raw(struct iio_dev *indio_dev, long mask) { struct adis *st = iio_priv(indio_dev); - int bits = 10; - s16 val16; u8 addr; switch (mask) { case IIO_CHAN_INFO_CALIBBIAS: - val16 = val & ((1 << bits) - 1); addr = adis16240_addresses[chan->scan_index][0]; - return adis_write_reg_16(st, addr, val16); + return adis_write_reg_16(st, addr, val & GENMASK(9, 0)); } return -EINVAL; } |