From: Martin Kelly Date: Tue, 1 May 2018 17:56:42 +0000 (-0700) Subject: iio: imu: inv_mpu6050: make loop a do-while X-Git-Tag: for-linus-20180616~25^2~119^2~41 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=cbf73ae59bee340f423479eb48aef9a0efdd8010;p=linux-2.6-block.git 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 Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c index 97d965181635..1795418438e4 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c @@ -175,7 +175,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) if (kfifo_len(&st->timestamps) > fifo_count / bytes_per_datum + INV_MPU6050_TIME_STAMP_TOR) goto flush_fifo; - while (fifo_count >= bytes_per_datum) { + do { result = regmap_bulk_read(st->map, st->reg->fifo_r_w, data, bytes_per_datum); if (result) @@ -194,7 +194,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) timestamp); fifo_count -= bytes_per_datum; - } + } while (fifo_count >= bytes_per_datum); end_session: mutex_unlock(&st->lock);