driver,mpu6500: improve readfifo
authorZorro Liu <lyx@rock-chips.com>
Tue, 23 Aug 2016 07:00:00 +0000 (15:00 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 24 Aug 2016 05:07:34 +0000 (13:07 +0800)
while (fifo_count == 0) && (kfifo_len(&st->timestamps) > 0) then flush fifo

Change-Id: I9b4ab975d708ee1bb02435bca933ce8f3b55e037
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
drivers/staging/iio/imu/inv_mpu/inv_mpu_ring.c

index d8558d75c70d4a442e8ae23eaa1a795c46cc8d46..bfff9c5d48c90af0bdb0f3d60b26ab5b53d228e4 100644 (file)
@@ -1002,7 +1002,7 @@ irqreturn_t inv_read_fifo(int irq, void *dev_id)
                if (result)
                        goto end_session;
                fifo_count = be16_to_cpup((__be16 *)(&data[0]));
-               if (fifo_count == 0)
+               if ((fifo_count == 0) && (kfifo_len(&st->timestamps) > 0))
                        goto flush_fifo;
                if (fifo_count < bytes_per_datum)
                        goto end_session;