Skip to content

Commit 79dabbd

Browse files
lixuzhajic23
authored andcommitted
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: 39a3a01 ("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>
1 parent 8b518cd commit 79dabbd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/iio/light/hid-sensor-prox.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ static int prox_read_raw(struct iio_dev *indio_dev,
124124
ret_type = prox_state->scale_precision[chan->scan_index];
125125
break;
126126
case IIO_CHAN_INFO_OFFSET:
127-
*val = hid_sensor_convert_exponent(
128-
prox_state->prox_attr[chan->scan_index].unit_expo);
127+
*val = 0;
129128
ret_type = IIO_VAL_INT;
130129
break;
131130
case IIO_CHAN_INFO_SAMP_FREQ:

0 commit comments

Comments
 (0)