summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Lixu <lixu.zhang@intel.com>2025-03-31 08:50:22 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2025-04-07 21:32:50 +0300
commit79dabbd505210e41c88060806c92c052496dd61c (patch)
tree2a51e15053642be626c73232485ba4a2fb8a4e0e
parent8b518cdb03f5f6e06d635cbfd9583d1fdbb39bfd (diff)
downloadlinux-79dabbd505210e41c88060806c92c052496dd61c.tar.xz
iio: hid-sensor-prox: Fix incorrect OFFSET calculation
The OFFSET calculation in the prox_read_raw() was incorrectly using the unit exponent, which is intended for SCALE calculations. Remove the incorrect OFFSET calculation and set it to a fixed value of 0. Cc: stable@vger.kernel.org Fixes: 39a3a0138f61 ("iio: hid-sensors: Added Proximity Sensor Driver") Signed-off-by: Zhang Lixu <lixu.zhang@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Link: https://patch.msgid.link/20250331055022.1149736-4-lixu.zhang@intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r--drivers/iio/light/hid-sensor-prox.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index 941508e58286..4c65b32d34ce 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -124,8 +124,7 @@ static int prox_read_raw(struct iio_dev *indio_dev,
ret_type = prox_state->scale_precision[chan->scan_index];
break;
case IIO_CHAN_INFO_OFFSET:
- *val = hid_sensor_convert_exponent(
- prox_state->prox_attr[chan->scan_index].unit_expo);
+ *val = 0;
ret_type = IIO_VAL_INT;
break;
case IIO_CHAN_INFO_SAMP_FREQ: