Skip to content

Commit cbf73ae

Browse files
Martin Kellyjic23
authored andcommitted
iio: imu: inv_mpu6050: make loop a do-while
Prior to this loop, we check if fifo_count < bytes_per_datum and bail if so. This means that when we hit the loop, we know that fifo_count >= bytes_per_datum, so the check is unneeded and we can turn the loop into a do-while for a slight performance improvement. Signed-off-by: Martin Kelly <mkelly@xevo.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 21f4bb8 commit cbf73ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
175175
if (kfifo_len(&st->timestamps) >
176176
fifo_count / bytes_per_datum + INV_MPU6050_TIME_STAMP_TOR)
177177
goto flush_fifo;
178-
while (fifo_count >= bytes_per_datum) {
178+
do {
179179
result = regmap_bulk_read(st->map, st->reg->fifo_r_w,
180180
data, bytes_per_datum);
181181
if (result)
@@ -194,7 +194,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
194194
timestamp);
195195

196196
fifo_count -= bytes_per_datum;
197-
}
197+
} while (fifo_count >= bytes_per_datum);
198198

199199
end_session:
200200
mutex_unlock(&st->lock);

0 commit comments

Comments
 (0)