Skip to contentSkip to conversation

iio: gyro: bmg160: fix buffer read values

PATCH In review Irina Tirdea 3 participants 3 messages Mar 28, 2016 – Apr 7, 2016 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: gyro: bmg160: fix buffer read values

When reading gyroscope axes using iio buffers, the values returned are always 0. In the interrupt handler, the return value of the read operation is returned to the user instead of the value read. Return the value read to the user.

This is also fixed in commit 82d8e5da1a33 ("iio:
accel: bmg160: optimize transfers in trigger handler").

---
 drivers/iio/gyro/bmg160_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/gyro/bmg160_core.c +1 -1
index 295cf1d..e165ce9 100644
@@ -781,7 +781,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)
 			mutex_unlock(&data->mutex);
 			goto err;
 		}
-		data->buffer[i++] = ret;
+		data->buffer[i++] = val;
 	}
 	mutex_unlock(&data->mutex);
 
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 9 lines · Irina Tirdea

When reading gyroscope axes using iio buffers, the values returned are always 0. In the interrupt handler, the return value of the read operation is returned to the user instead of the value read. Return the value read to the user.

This is also fixed in commit 82d8e5da1a33 ("iio:
accel: bmg160: optimize transfers in trigger handler").

Ouch. Applied and marked for stable.

Jonathan

Quoted 18 lines
---
 drivers/iio/gyro/bmg160_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/gyro/bmg160_core.c +1 -1
index 295cf1d..e165ce9 100644
@@ -781,7 +781,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)
 			mutex_unlock(&data->mutex);
 			goto err;
 		}
-		data->buffer[i++] = ret;
+		data->buffer[i++] = val;
 	}
 	mutex_unlock(&data->mutex);
 
#2 lore raw
In reply to Irina Tirdea

Hi,

Quoted 9 lines · On Monday 28 March 2016 20:15:46 Irina Tirdea wrote:

When reading gyroscope axes using iio buffers, the values returned are always 0. In the interrupt handler, the return value of the read operation is returned to the user instead of the value read. Return the value read to the user.

This is also fixed in commit 82d8e5da1a33 ("iio:
accel: bmg160: optimize transfers in trigger handler").

Thanks a lot for fixing all the bugs I introduced.

Best Regards,

Markus

Quoted 18 lines
---
 drivers/iio/gyro/bmg160_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/gyro/bmg160_core.c +1 -1
index 295cf1d..e165ce9 100644
@@ -781,7 +781,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)
 			mutex_unlock(&data->mutex);
 			goto err;
 		}
-		data->buffer[i++] = ret;
+		data->buffer[i++] = val;
 	}
 	mutex_unlock(&data->mutex);
 
Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |