Skip to contentSkip to conversation

iio: light: apds9960: correct FIFO check condition

PATCH Applied Matt Ranostay 2 participants 4 messages Mar 18, 2016 – Mar 28, 2016 1 message not in the archive IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: light: apds9960: correct FIFO check condition

Correct issue that the last entry in FIFO was being read twice due to an incorrect decrement of entry count variable before condition check.

---
 drivers/iio/light/apds9960.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/light/apds9960.c +2 -1
index f6a07dc..a6af56a 100644
@@ -769,7 +769,7 @@ static void apds9960_read_gesture_fifo(struct apds9960_data *data)
 	mutex_lock(&data->lock);
 	data->gesture_mode_running = 1;
 
-	while (cnt-- || (cnt = apds9660_fifo_is_empty(data) > 0)) {
+	while (cnt || (cnt = apds9660_fifo_is_empty(data) > 0)) {
 		ret = regmap_bulk_read(data->regmap, APDS9960_REG_GFIFO_BASE,
 				      &data->buffer, 4);
 
@@ -777,6 +777,7 @@ static void apds9960_read_gesture_fifo(struct apds9960_data *data)
 			goto err_read;
 
 		iio_push_to_buffers(data->indio_dev, data->buffer);
+		cnt--;
 	}
 
 err_read:
Signature · 1 line
2.7.0
maintainer Applied
#1 lore raw
Quoted 5 lines · Matt Ranostay

Correct issue that the last entry in FIFO was being read twice due to an incorrect decrement of entry count variable before condition check.

Applied to the fixes branch of iio.git.

Thanks,

Jonathan

Quoted 26 lines
---
 drivers/iio/light/apds9960.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/light/apds9960.c +2 -1
index f6a07dc..a6af56a 100644
@@ -769,7 +769,7 @@ static void apds9960_read_gesture_fifo(struct apds9960_data *data)
 	mutex_lock(&data->lock);
 	data->gesture_mode_running = 1;
 
-	while (cnt-- || (cnt = apds9660_fifo_is_empty(data) > 0)) {
+	while (cnt || (cnt = apds9660_fifo_is_empty(data) > 0)) {
 		ret = regmap_bulk_read(data->regmap, APDS9960_REG_GFIFO_BASE,
 				      &data->buffer, 4);
 
@@ -777,6 +777,7 @@ static void apds9960_read_gesture_fifo(struct apds9960_data *data)
 			goto err_read;
 
 		iio_push_to_buffers(data->indio_dev, data->buffer);
+		cnt--;
 	}
 
 err_read:

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Re: [PATCH] iio: health: max30100: correct FIFO check condition

This get lost in the inbox? :)
Same fix as for APDS9660 issue in the FIFO

Quoted 31 lines · Matt Ranostay

Correct issue that the last entry in FIFO was being read twice due to an incorrect decrement of entry count variable before condition check.

---
 drivers/iio/health/max30100.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/health/max30100.c +2 -2
index 09db893..90ab8a2d 100644
@@ -238,12 +238,13 @@ static irqreturn_t max30100_interrupt_handler(int irq, void *private)
 
        mutex_lock(&data->lock);
 
-       while (cnt-- || (cnt = max30100_fifo_count(data) > 0)) {
+       while (cnt || (cnt = max30100_fifo_count(data) > 0)) {
                ret = max30100_read_measurement(data);
                if (ret)
                        break;
 
                iio_push_to_buffers(data->indio_dev, data->buffer);
+               cnt--;
        }
 
        mutex_unlock(&data->lock);
--

2.7.0

maintainer Applied
#4 lore raw

Re: [PATCH] iio: health: max30100: correct FIFO check condition

Quoted 9 lines · Matt Ranostay

This get lost in the inbox? :)
Same fix as for APDS9660 issue in the FIFO

Quoted 5 lines · Matt Ranostay

Correct issue that the last entry in FIFO was being read twice due to an incorrect decrement of entry count variable before condition check.

Odd - disappeared without trace. Well spotted.

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

Thanks,

Jonathan

Quoted 31 lines
Quoted 24 lines
---
 drivers/iio/health/max30100.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/health/max30100.c +2 -2
index 09db893..90ab8a2d 100644
@@ -238,12 +238,13 @@ static irqreturn_t max30100_interrupt_handler(int irq, void *private)
 
        mutex_lock(&data->lock);
 
-       while (cnt-- || (cnt = max30100_fifo_count(data) > 0)) {
+       while (cnt || (cnt = max30100_fifo_count(data) > 0)) {
                ret = max30100_read_measurement(data);
                if (ret)
                        break;
 
                iio_push_to_buffers(data->indio_dev, data->buffer);
+               cnt--;
        }
 
        mutex_unlock(&data->lock);
--
Quoted 2 lines

2.7.0

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html