diff options
author | Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> | 2016-11-16 22:15:28 +0100 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-12-31 14:32:09 +0000 |
commit | 65c8aea07de11b6507efa175edb44bd8b4488218 (patch) | |
tree | f16e596bed7448b837e52ddd5da385636de27003 /net | |
parent | b4e8a0eb718749455601fa7b283febc42cca8957 (diff) |
iio: common: st_sensors: fix channel data parsing
Using realbits as i2c/spi read len, when that value is not byte aligned
(e.g 12 bits), lead to skip msb part of out data registers.
Fix this taking into account scan_type.shift in addition to
scan_type.realbits as read length:
read_len = DIV_ROUND_UP(realbits + shift, 8)
This fix has been tested on 8, 12, 16, 24 bit sensors
Fixes: e7385de5291e ("iio:st_sensors: align on storagebits boundaries")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'net')
0 files changed, 0 insertions, 0 deletions