Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Peter Meerwald and committed by
Jonathan Cameron
bc74fb81 09a1737e

+2 -3
+2 -3
drivers/iio/adc/ad7476.c
··· 14 14 #include <linux/regulator/consumer.h> 15 15 #include <linux/err.h> 16 16 #include <linux/module.h> 17 + #include <linux/bitops.h> 17 18 18 19 #include <linux/iio/iio.h> 19 20 #include <linux/iio/sysfs.h> 20 21 #include <linux/iio/buffer.h> 21 22 #include <linux/iio/trigger_consumer.h> 22 23 #include <linux/iio/triggered_buffer.h> 23 - 24 - #define RES_MASK(bits) ((1 << (bits)) - 1) 25 24 26 25 struct ad7476_state; 27 26 ··· 116 117 if (ret < 0) 117 118 return ret; 118 119 *val = (ret >> st->chip_info->channel[0].scan_type.shift) & 119 - RES_MASK(st->chip_info->channel[0].scan_type.realbits); 120 + GENMASK(st->chip_info->channel[0].scan_type.realbits - 1, 0); 120 121 return IIO_VAL_INT; 121 122 case IIO_CHAN_INFO_SCALE: 122 123 if (!st->chip_info->int_vref_uv) {