summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/ad7476.c
diff options
context:
space:
mode:
authorPeter Meerwald <pmeerw@pmeerw.net>2014-12-06 06:00:00 +0000
committerJonathan Cameron <jic23@kernel.org>2014-06-14 16:03:48 +0100
commitbc74fb8191c0405e17925473e940db65be1b80e7 (patch)
tree61dcf3843a3722560e01376e67d054f5e1753879 /drivers/iio/adc/ad7476.c
parent09a1737e5509aff28346a7225a2eae35d1c5962f (diff)
downloadlinux-bc74fb8191c0405e17925473e940db65be1b80e7.tar.gz
linux-bc74fb8191c0405e17925473e940db65be1b80e7.tar.bz2
linux-bc74fb8191c0405e17925473e940db65be1b80e7.zip
iio:adc:ad7476: Use GENMASK() macro
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc/ad7476.c')
-rw-r--r--drivers/iio/adc/ad7476.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
index d141d452c3d1..ce400ec176f1 100644
--- a/drivers/iio/adc/ad7476.c
+++ b/drivers/iio/adc/ad7476.c
@@ -14,6 +14,7 @@
#include <linux/regulator/consumer.h>
#include <linux/err.h>
#include <linux/module.h>
+#include <linux/bitops.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
@@ -21,8 +22,6 @@
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
-#define RES_MASK(bits) ((1 << (bits)) - 1)
-
struct ad7476_state;
struct ad7476_chip_info {
@@ -117,7 +116,7 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,
if (ret < 0)
return ret;
*val = (ret >> st->chip_info->channel[0].scan_type.shift) &
- RES_MASK(st->chip_info->channel[0].scan_type.realbits);
+ GENMASK(st->chip_info->channel[0].scan_type.realbits - 1, 0);
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE:
if (!st->chip_info->int_vref_uv) {