Commit 79dabbd5 authored by Zhang Lixu's avatar Zhang Lixu Committed by Jonathan Cameron
Browse files

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: 39a3a013 ("iio: hid-sensors: Added Proximity Sensor Driver")
Signed-off-by: default avatarZhang Lixu <lixu.zhang@intel.com>
Acked-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://patch.msgid.link/20250331055022.1149736-4-lixu.zhang@intel.com


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 8b518cdb
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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: