aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/ad7476.c
diff options
context:
space:
mode:
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 @@
14#include <linux/regulator/consumer.h> 14#include <linux/regulator/consumer.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/bitops.h>
17 18
18#include <linux/iio/iio.h> 19#include <linux/iio/iio.h>
19#include <linux/iio/sysfs.h> 20#include <linux/iio/sysfs.h>
@@ -21,8 +22,6 @@
21#include <linux/iio/trigger_consumer.h> 22#include <linux/iio/trigger_consumer.h>
22#include <linux/iio/triggered_buffer.h> 23#include <linux/iio/triggered_buffer.h>
23 24
24#define RES_MASK(bits) ((1 << (bits)) - 1)
25
26struct ad7476_state; 25struct ad7476_state;
27 26
28struct ad7476_chip_info { 27struct ad7476_chip_info {
@@ -117,7 +116,7 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,
117 if (ret < 0) 116 if (ret < 0)
118 return ret; 117 return ret;
119 *val = (ret >> st->chip_info->channel[0].scan_type.shift) & 118 *val = (ret >> st->chip_info->channel[0].scan_type.shift) &
120 RES_MASK(st->chip_info->channel[0].scan_type.realbits); 119 GENMASK(st->chip_info->channel[0].scan_type.realbits - 1, 0);
121 return IIO_VAL_INT; 120 return IIO_VAL_INT;
122 case IIO_CHAN_INFO_SCALE: 121 case IIO_CHAN_INFO_SCALE:
123 if (!st->chip_info->int_vref_uv) { 122 if (!st->chip_info->int_vref_uv) {