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

iio: mma7455: Use scan_type when processing raw data

Use channel definition as root of trust and replace constant
when reading elements directly using the raw sysfs attributes.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211104082413.3681212-4-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Gwendal Grignou and committed by
Jonathan Cameron
1aa2f96a 9105079d

+2 -1
+2 -1
drivers/iio/accel/mma7455_core.c
··· 134 134 if (ret) 135 135 return ret; 136 136 137 - *val = sign_extend32(le16_to_cpu(data), 9); 137 + *val = sign_extend32(le16_to_cpu(data), 138 + chan->scan_type.realbits - 1); 138 139 139 140 return IIO_VAL_INT; 140 141