inv_mpu6050 minor cleanup
Subsystems (2)
cover inv_mpu6050 minor cleanup
These patches are minor cleanup for the inv_mpu6050 driver. They should be applied to the iio testing branch, as they won't apply cleanly to master due to recent changes in inv_mpu6050.
Martin Kelly (2):
iio: imu: inv_mpu6050: minor grammar fixes
iio: imu: inv_mpu6050: make loop a do-while
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 +- drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 2 +- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/2 iio: imu: inv_mpu6050: minor wording fixes
Just some minor grammar/spelling fixes of things I noticed while reading the code.
--- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 +- drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 2 +- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +1 -1
@@ -176,7 +176,7 @@ int inv_mpu6050_switch_engine(struct inv_mpu6050_state *st, bool en, u32 mask)return result;if (en) { -/* Wait for output stabilize */ +/* Wait for output to stabilize */ msleep (INV_MPU6050_TEMP_UP_TIME );if (mask ==INV_MPU6050_BIT_PWR_GYRO_STBY ) {/* switch internal clock to PLL */
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c +1 -1
@@ -53,7 +53,7 @@ static int inv_mpu6050_deselect_bypass(struct i2c_mux_core *muxc, u32 chan_id)mutex_lock (&st->lock); -/* It doesn't really mattter, if any of the calls fails */ +/* It doesn't really matter if any of the calls fail */ regmap_write (st->map, st->reg->int_pin_cfg, st->irq_mask);inv_mpu6050_set_power_itg (st, false);
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +2 -2
@@ -155,7 +155,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) bytes_per_datum +=INV_MPU6050_BYTES_PER_3AXIS_SENSOR ;/* -* read fifo_count register to know how many bytes inside FIFO +* read fifo_count register to know how many bytes are inside the FIFO * right now */ result = regmap_bulk_read(st->map, st->reg->fifo_count_h, data,
@@ -165,7 +165,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) fifo_count =be16_to_cpup ((__be16 *)(&data[0 ]));if (fifo_count < bytes_per_datum) goto end_session; -/* fifo count can't be odd number, if it is odd, reset fifo*/ +/* fifo count can't be an odd number. If it is odd, reset the FIFO. */ if (fifo_count &1 ) goto flush_fifo;if (fifo_count >INV_MPU6050_FIFO_THRESHOLD )
Signature · 1 line
2.11.0
Re: [PATCH 1/2] iio: imu: inv_mpu6050: minor wording fixes
Quoted 4 lines · On Tue, 1 May 2018 10:56:41 -0700 Martin Kelly <[email protected]> wrote:
Just some minor grammar/spelling fixes of things I noticed while reading the code.
Signed-off-by Martin Kelly <[email protected]>
Good to clean this sort of thing up.
Thanks and applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to ignore it ;)
Thanks,
Jonathan
Quoted 54 lines
--- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 +- drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 2 +- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +1
-1@@ -176,7 +176,7 @@ int inv_mpu6050_switch_engine(struct inv_mpu6050_state *st, bool en, u32 mask)return result;if (en) { -/* Wait for output stabilize */ +/* Wait for output to stabilize */ msleep (INV_MPU6050_TEMP_UP_TIME );if (mask ==INV_MPU6050_BIT_PWR_GYRO_STBY ) {/* switch internal clock to PLL */ drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c +1
-1@@ -53,7 +53,7 @@ static int inv_mpu6050_deselect_bypass(struct i2c_mux_core *muxc, u32 chan_id)mutex_lock (&st->lock); -/* It doesn't really mattter, if any of the calls fails */ +/* It doesn't really matter if any of the calls fail */ regmap_write (st->map, st->reg->int_pin_cfg, st->irq_mask);inv_mpu6050_set_power_itg (st, false);drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +2
-2@@ -155,7 +155,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) bytes_per_datum +=INV_MPU6050_BYTES_PER_3AXIS_SENSOR ;/* -* read fifo_count register to know how many bytes inside FIFO +* read fifo_count register to know how many bytes are inside the FIFO * right now */ result = regmap_bulk_read(st->map, st->reg->fifo_count_h, data,@@ -165,7 +165,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) fifo_count =be16_to_cpup ((__be16 *)(&data[0 ]));if (fifo_count < bytes_per_datum) goto end_session; -/* fifo count can't be odd number, if it is odd, reset fifo*/ +/* fifo count can't be an odd number. If it is odd, reset the FIFO. */ if (fifo_count &1 ) goto flush_fifo;if (fifo_count >INV_MPU6050_FIFO_THRESHOLD )
PATCH 2/2 iio: imu: inv_mpu6050: make loop a do-while
In reply to Martin KellyPrior 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.
--- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +2 -2
@@ -174,7 +174,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)
@@ -188,7 +188,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)iio_push_to_buffers_with_timestamp (indio_dev, data, timestamp); fifo_count -= bytes_per_datum; - } + }while (fifo_count >= bytes_per_datum); end_session:mutex_unlock (&st->lock);
Signature · 1 line
2.11.0
Re: [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while
Quoted 6 lines · On Tue, 1 May 2018 10:56:42 -0700 Martin Kelly <[email protected]> wrote:
Prior to this loop, we check if
fifo_count<bytes_per_datumand bail if so. This means that when we hit the loop, we know thatfifo_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 <[email protected]>
Seems logical to me, but I'd like to give Jean-Baptiste a chance to comment on this one.
If it looks like we have forgotten about it in a week or so do give me a poke!
Thanks,
Jonathan
Quoted 26 lines
--- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +2
-2@@ -174,7 +174,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)@@ -188,7 +188,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)iio_push_to_buffers_with_timestamp (indio_dev, data, timestamp); fifo_count -= bytes_per_datum; - } + }while (fifo_count >= bytes_per_datum); end_session:mutex_unlock (&st->lock);
Re: [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while
Quoted 12 lines · Jonathan Cameron
Quoted 6 lines · On Tue, 1 May 2018 10:56:42 -0700 Martin Kelly <[email protected]> wrote:
Prior to this loop, we check if
fifo_count<bytes_per_datumand bail if so. This means that when we hit the loop, we know thatfifo_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 <[email protected]>Seems logical to me, but I'd like to give Jean-Baptiste a chance to comment on this one.
Quoted 6 lines
If it looks like we have forgotten about it in a week or so do give me a poke!
Thanks,
Jonathan
Hello,
no problem for me, looks good. Anyway, I'm planning additionnal changes that are going to change completely this loop.
JB
Quoted 33 lines
Quoted 19 lines
--- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +1
-1@@ -174,7 +174,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)drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) · line 194
Quoted 8 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +1
-1@@ -188,7 +188,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)iio_push_to_buffers_with_timestamp (indio_dev, data, timestamp); fifo_count -= bytes_per_datum; - } + }while (fifo_count >= bytes_per_datum); end_session:mutex_unlock (&st->lock);--
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
Re: [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while
Quoted 16 lines · On Tue, 8 May 2018 16:34:30 +0200 Jean-Baptiste Maneyrol…
Quoted 15 lines · Jonathan Cameron
Quoted 6 lines · On Tue, 1 May 2018 10:56:42 -0700 Martin Kelly <[email protected]> wrote:
Prior to this loop, we check if
fifo_count<bytes_per_datumand bail if so. This means that when we hit the loop, we know thatfifo_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 <[email protected]>Seems logical to me, but I'd like to give Jean-Baptiste a chance to comment on this one.
If it looks like we have forgotten about it in a week or so do give me a poke!
Quoted 7 lines
Quoted 3 lines
Thanks,
Jonathan
Hello,
no problem for me, looks good. Anyway, I'm planning additionnal changes that are going to change completely this loop.
Ah well, Applied anyway in the meantime.
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
Quoted 39 lines
JB
Quoted 25 lines
Quoted 25 lines
--- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +2
-2@@ -174,7 +174,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)@@ -188,7 +188,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)iio_push_to_buffers_with_timestamp (indio_dev, data, timestamp); fifo_count -= bytes_per_datum; - } + }while (fifo_count >= bytes_per_datum);Quoted 8 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) · line 194
Quoted 2 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +0
-0end_session:mutex_unlock (&st->lock);--
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--
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
Re: [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while
Quoted 29 lines · Jonathan Cameron
CAUTION: This email originated from outside of the organization. Please make sure the sender is who they say they are and do not click links or open attachments unless you recognize the sender and know the content is safe.
Quoted 16 lines · On Tue, 8 May 2018 16:34:30 +0200 Jean-Baptiste Maneyrol…
Quoted 15 lines · Jonathan Cameron
Quoted 6 lines · On Tue, 1 May 2018 10:56:42 -0700 Martin Kelly <[email protected]> wrote:
Prior to this loop, we check if
fifo_count<bytes_per_datumand bail if so. This means that when we hit the loop, we know thatfifo_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 <[email protected]>Seems logical to me, but I'd like to give Jean-Baptiste a chance to comment on this one.
If it looks like we have forgotten about it in a week or so do give me a poke!
Quoted 7 lines
Quoted 3 lines
Thanks,
Jonathan
Hello,
no problem for me, looks good. Anyway, I'm planning additionnal changes that are going to change completely this loop.
Quoted 8 lines
Ah well, Applied anyway in the meantime.
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
Hello Jonathan,
it's strange, I can't find this patch in the testing branch. Is it expected?
Thanks.
JB
Quoted 46 lines
Quoted 36 lines
JB
Quoted 25 lines
Quoted 25 lines
--- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +2
-2@@ -174,7 +174,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)@@ -188,7 +188,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)iio_push_to_buffers_with_timestamp (indio_dev, data, timestamp); fifo_count -= bytes_per_datum; - } + }while (fifo_count >= bytes_per_datum);Quoted 8 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) · line 194
Quoted 2 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +0
-0end_session:mutex_unlock (&st->lock);--
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.htmlQuoted 4 lines
--
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--
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
Re: [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while
Quoted 47 lines · Jean-Baptiste Maneyrol
Quoted 1 line · Jonathan Cameron
CAUTION: This email originated from outside of the organization.
Please make sure the sender is who they say they are and do not click links or open attachments unless you recognize the sender and know the content is safe.
Quoted 10 lines
Quoted 5 lines · On Tue, 8 May 2018 16:34:30 +0200 Jean-Baptiste Maneyrol…
Quoted 4 lines · Jonathan Cameron
Quoted 1 line · On Tue, 1 May 2018 10:56:42 -0700 Martin Kelly <[email protected]> wrote:
Prior to this loop, we check if
fifo_count<bytes_per_datumandbail if
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
so. This means that when we hit the loop, we know that
fifo_count=
Quoted 1 line
Quoted 1 line
Quoted 1 line
bytes_per_datum, so the check is unneeded and we can turn the loopinto
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
a do-while for a slight performance improvement.
Signed-off-by Martin Kelly <[email protected]>Seems logical to me, but I'd like to give Jean-Baptiste a chance to comment on this one.
If it looks like we have forgotten about it in a week or so do give me a poke!
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Thanks,
Jonathan
Hello,
no problem for me, looks good. Anyway, I'm planning additionnal
changes
Quoted 4 lines
Quoted 1 line
that are going to change completely this loop.
Ah well, Applied anyway in the meantime.
Applied to the togreg branch of iio.git and pushed out as testing for
the
Quoted 4 lines
autobuilders to play with it.
Thanks,
Quoted 8 lines
Quoted 1 line
Jonathan
Hello Jonathan,
it's strange, I can't find this patch in the testing branch. Is it expected?
Thanks.
JB
That's usually a sure sign I have been a Muppet and forgotten to push.
Thanks, should be there now.
Quoted 58 lines
Quoted 10 lines
Quoted 10 lines
JB
Quoted 6 lines
Review
Quoted 6 lines
--- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.cQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c irqreturn_t inv_mpu6050_read_fifo(int irq,
Quoted 4 lines
index
0cb7c20100ca..11593deaaebd100644drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +0
-0@@ -174,7 +174,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq,void *p)
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c irqreturn_t inv_mpu6050_read_fifo(int irq,
Quoted 9 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +1
-1if (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)@@ -188,7 +188,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq,void *p)
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c irqreturn_t inv_mpu6050_read_fifo(int irq, · line 188
Quoted 1 line
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +0
-0iio_push_to_buffers_with_timestamp(indio_dev, data,timestamp);
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) · line 194
Quoted 7 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +1
-1fifo_count -= bytes_per_datum; - } + }while (fifo_count >= bytes_per_datum); end_session:mutex_unlock (&st->lock);--
To unsubscribe from this list: send the line "unsubscribelinux-iio" in
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-iio"in
Quoted 5 lines
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-iio"in
Quoted 3 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
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
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.