From: Miquel Raynal Date: Wed, 18 Aug 2021 11:11:24 +0000 (+0200) Subject: iio: adc: max1027: Fix wrong shift with 12-bit devices X-Git-Tag: v5.15-rc6~13^2~2^2~12 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=732ae19ee8f58ecaf30cbc1bbbda5cbee6a45043;p=users%2Fdwmw2%2Flinux.git iio: adc: max1027: Fix wrong shift with 12-bit devices 10-bit devices must shift the value twice. This is not needed anymore on 12-bit devices. Fixes: ae47d009b508 ("iio: adc: max1027: Introduce 12-bit devices support") Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal Reviewed-by: Nuno Sá Link: https://lore.kernel.org/r/20210818111139.330636-2-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c index 655ab02d03d84..4a42d140a4b06 100644 --- a/drivers/iio/adc/max1027.c +++ b/drivers/iio/adc/max1027.c @@ -103,7 +103,7 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids); .sign = 'u', \ .realbits = depth, \ .storagebits = 16, \ - .shift = 2, \ + .shift = (depth == 10) ? 2 : 0, \ .endianness = IIO_BE, \ }, \ }