From: Zhang Lixu <lixu.zhang@intel.com>
To: linux-iio@vger.kernel.org, jic23@kernel.org, lars@metafoo.de,
jikos@kernel.org, srinivas.pandruvada@linux.intel.com,
peterz@infradead.org, gregkh@linuxfoundation.org,
ribalda@chromium.org, archana.patni@linux.intel.com,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Cc: lixu.zhang@intel.com, even.xu@intel.com
Subject: [PATCH 3/3] iio: hid-sensor-prox: Fix incorrect OFFSET calculation
Date: Mon, 31 Mar 2025 13:50:22 +0800 [thread overview]
Message-ID: <20250331055022.1149736-4-lixu.zhang@intel.com> (raw)
In-Reply-To: <20250331055022.1149736-1-lixu.zhang@intel.com>
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>
---
drivers/iio/light/hid-sensor-prox.c | 3 +--
1 file changed, 1 insertion(+), 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:
--
2.43.0
next prev parent reply other threads:[~2025-03-31 5:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-31 5:50 [PATCH 0/3] iio: hid-sensor-prox: fix SCALE and OFFSET calculation Zhang Lixu
2025-03-31 5:50 ` [PATCH 1/3] iio: hid-sensor-prox: Restore lost scale assignments Zhang Lixu
2025-03-31 5:50 ` [PATCH 2/3] iio: hid-sensor-prox: support multi-channel SCALE calculation Zhang Lixu
2025-03-31 5:50 ` Zhang Lixu [this message]
2025-03-31 11:00 ` [PATCH 0/3] iio: hid-sensor-prox: fix SCALE and OFFSET calculation Jonathan Cameron
2025-03-31 14:20 ` srinivas pandruvada
2025-04-01 2:12 ` Zhang, Lixu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250331055022.1149736-4-lixu.zhang@intel.com \
--to=lixu.zhang@intel.com \
--cc=archana.patni@linux.intel.com \
--cc=even.xu@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=jikos@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=ribalda@chromium.org \
--cc=srinivas.pandruvada@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox