[PATCH v2] iio: hid-sensor-prox: Fix invalid read_raw for attention

Ricardo Ribalda posted 1 patch 1 day, 9 hours ago
drivers/iio/light/hid-sensor-prox.c | 1 +
1 file changed, 1 insertion(+)
[PATCH v2] iio: hid-sensor-prox: Fix invalid read_raw for attention
Posted by Ricardo Ribalda 1 day, 9 hours ago
The attention channel is a IIO_CHAN_INFO_PROCESSED, not a
IIO_CHAN_INFO_RAW.

Modify prox_read_raw() to support it.

Fixes: 596ef5cf654b ("iio: hid-sensor-prox: Add support for more channels")
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
Changes in v2:
- Do not change the condition for applying the multiplier.
- Link to v1: https://lore.kernel.org/r/20241121-fix-processed-v1-1-4fae6770db30@chromium.org
---
 drivers/iio/light/hid-sensor-prox.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index e8e7b2999b4c..0daa8d365a6c 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -94,6 +94,7 @@ static int prox_read_raw(struct iio_dev *indio_dev,
 	*val2 = 0;
 	switch (mask) {
 	case IIO_CHAN_INFO_RAW:
+	case IIO_CHAN_INFO_PROCESSED:
 		if (chan->scan_index >= prox_state->num_channels)
 			return -EINVAL;
 		address = prox_state->channel2usage[chan->scan_index];

---
base-commit: decc701f41d07481893fdea942c0ac6b226e84cd
change-id: 20241121-fix-processed-ed1a95641e64

Best regards,
-- 
Ricardo Ribalda <ribalda@chromium.org>
Re: [PATCH v2] iio: hid-sensor-prox: Fix invalid read_raw for attention
Posted by srinivas pandruvada 1 day, 8 hours ago
On Fri, 2024-11-22 at 17:36 +0000, Ricardo Ribalda wrote:
> The attention channel is a IIO_CHAN_INFO_PROCESSED, not a
> IIO_CHAN_INFO_RAW.
> 
> Modify prox_read_raw() to support it.
> 
> Fixes: 596ef5cf654b ("iio: hid-sensor-prox: Add support for more
> channels")
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>

Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> ---
> Changes in v2:
> - Do not change the condition for applying the multiplier.
> - Link to v1:
> https://lore.kernel.org/r/20241121-fix-processed-v1-1-4fae6770db30@chromium.org
> ---
>  drivers/iio/light/hid-sensor-prox.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/light/hid-sensor-prox.c
> b/drivers/iio/light/hid-sensor-prox.c
> index e8e7b2999b4c..0daa8d365a6c 100644
> --- a/drivers/iio/light/hid-sensor-prox.c
> +++ b/drivers/iio/light/hid-sensor-prox.c
> @@ -94,6 +94,7 @@ static int prox_read_raw(struct iio_dev *indio_dev,
>  	*val2 = 0;
>  	switch (mask) {
>  	case IIO_CHAN_INFO_RAW:
> +	case IIO_CHAN_INFO_PROCESSED:
>  		if (chan->scan_index >= prox_state->num_channels)
>  			return -EINVAL;
>  		address = prox_state->channel2usage[chan-
> >scan_index];
> 
> ---
> base-commit: decc701f41d07481893fdea942c0ac6b226e84cd
> change-id: 20241121-fix-processed-ed1a95641e64
> 
> Best regards,