diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2021-11-04 09:24:02 +0100 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-11-17 18:51:40 +0100 |
commit | 9105079db67a64fa58c10e699aabfe4703f5ac3f (patch) | |
tree | fa0a29de29a6e785bf4b2079e327246a5e74641e /drivers/iio | |
parent | iio: bma220: Use scan_type when processing raw data (diff) | |
download | linux-9105079db67a64fa58c10e699aabfe4703f5ac3f.tar.xz linux-9105079db67a64fa58c10e699aabfe4703f5ac3f.zip |
iio: kxcjk-1013: 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-3-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/accel/kxcjk-1013.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index a51fdd3c9b5b..88cf0c276893 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -927,7 +927,8 @@ static int kxcjk1013_read_raw(struct iio_dev *indio_dev, mutex_unlock(&data->mutex); return ret; } - *val = sign_extend32(ret >> 4, 11); + *val = sign_extend32(ret >> chan->scan_type.shift, + chan->scan_type.realbits - 1); ret = kxcjk1013_set_power_state(data, false); } mutex_unlock(&data->mutex); |