Skip to contentSkip to conversation

iio: hid-sensor-prox: Fix invalid read_raw for attention

PATCH Applied Ricardo Ribalda 3 participants 3 messages Nov 22, 2024 – Dec 15, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iio: hid-sensor-prox: Fix invalid read_raw for attention

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")

---
Changes in v2:
- Do not change the condition for applying the multiplier.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 drivers/iio/light/hid-sensor-prox.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/light/hid-sensor-prox.c +1 -0
index e8e7b2999b4c..0daa8d365a6c 100644
@@ -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,

Signature · 1 line
Ricardo Ribalda <[email protected]>
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 8 lines · Ricardo Ribalda

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")

Quoted 29 lines

---
Changes in v2:
- Do not change the condition for applying the multiplier.
- Link to v1:
https://lore.kernel.org/r/[email protected]
---
 drivers/iio/light/hid-sensor-prox.c | 1 +

 1 file changed, 1 insertion(+)
drivers/iio/light/hid-sensor-prox.c +0 -0
index e8e7b2999b4c..0daa8d365a6c 100644
@@ -94,6 +94,7 @@ static int prox_read_raw(struct iio_dev *indio_dev,
  	*val2 = 0;
  	switch (mask) {

  case IIO_CHAN_INFO_RAW:

drivers/iio/light/hid-sensor-prox.c +1 -0
+	case IIO_CHAN_INFO_PROCESSED:

  if (chan->scan_index >= prox_state->num_channels) return -EINVAL;
  address = prox_state->channel2usage[chan-

Quoted 1 line

scan_index];

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

Best regards,

maintainer Applied
#2 lore raw
Quoted 11 lines · On Fri, 22 Nov 2024 09:55:04 -0800 srinivas pandruvada…
Quoted 8 lines · Ricardo Ribalda

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")

Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

Quoted 31 lines
Quoted 30 lines

---
Changes in v2:
- Do not change the condition for applying the multiplier.
- Link to v1:
https://lore.kernel.org/r/[email protected]
---
 drivers/iio/light/hid-sensor-prox.c | 1 +

 1 file changed, 1 insertion(+)
drivers/iio/light/hid-sensor-prox.c +0 -0
index e8e7b2999b4c..0daa8d365a6c 100644
@@ -94,6 +94,7 @@ static int prox_read_raw(struct iio_dev *indio_dev,
  	*val2 = 0;
  	switch (mask) {

  case IIO_CHAN_INFO_RAW:

drivers/iio/light/hid-sensor-prox.c +1 -0
+	case IIO_CHAN_INFO_PROCESSED:

  if (chan->scan_index >= prox_state->num_channels) return -EINVAL;
  address = prox_state->channel2usage[chan-

Quoted 1 line

scan_index];

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

Best regards,