Skip to content

Commit 90d5cd6

Browse files
lixuzhagregkh
authored andcommitted
iio: hid-sensor-prox: Fix incorrect OFFSET calculation
[ Upstream commit 79dabbd ] 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: [email protected] Fixes: 39a3a01 ("iio: hid-sensors: Added Proximity Sensor Driver") Signed-off-by: Zhang Lixu <[email protected]> Acked-by: Srinivas Pandruvada <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]> [ adapted prox_attr array access to single structure member access ] Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0584747 commit 90d5cd6

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
@@ -102,8 +102,7 @@ static int prox_read_raw(struct iio_dev *indio_dev,
102102
ret_type = prox_state->scale_precision;
103103
break;
104104
case IIO_CHAN_INFO_OFFSET:
105-
*val = hid_sensor_convert_exponent(
106-
prox_state->prox_attr.unit_expo);
105+
*val = 0;
107106
ret_type = IIO_VAL_INT;
108107
break;
109108
case IIO_CHAN_INFO_SAMP_FREQ:

0 commit comments

Comments
 (0)