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>
This commit is contained in:
parent
9105079db6
commit
1aa2f96abb
@ -134,7 +134,8 @@ static int mma7455_read_raw(struct iio_dev *indio_dev,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
*val = sign_extend32(le16_to_cpu(data), 9);
|
||||
*val = sign_extend32(le16_to_cpu(data),
|
||||
chan->scan_type.realbits - 1);
|
||||
|
||||
return IIO_VAL_INT;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user