* [PATCH 0/2] inv_mpu6050 minor cleanup @ 2018-05-01 17:56 Martin Kelly 2018-05-01 17:56 ` [PATCH 1/2] iio: imu: inv_mpu6050: minor wording fixes Martin Kelly 2018-05-01 17:56 ` [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while Martin Kelly 0 siblings, 2 replies; 9+ messages in thread From: Martin Kelly @ 2018-05-01 17:56 UTC (permalink / raw) To: linux-iio; +Cc: Jean-Baptiste Maneyrol, Martin Kelly 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(-) -- 2.11.0 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] iio: imu: inv_mpu6050: minor wording fixes 2018-05-01 17:56 [PATCH 0/2] inv_mpu6050 minor cleanup Martin Kelly @ 2018-05-01 17:56 ` Martin Kelly 2018-05-06 17:06 ` Jonathan Cameron 2018-05-01 17:56 ` [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while Martin Kelly 1 sibling, 1 reply; 9+ messages in thread From: Martin Kelly @ 2018-05-01 17:56 UTC (permalink / raw) To: linux-iio; +Cc: Jean-Baptiste Maneyrol, Martin Kelly Just some minor grammar/spelling fixes of things I noticed while reading the code. Signed-off-by: Martin Kelly <mkelly@xevo.com> --- 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(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index aafa77766b08..59dbdeb08da4 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -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 */ diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c index 90fdc5eaef53..65dcb92be9f6 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c @@ -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); diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c index e51404fdce97..0cb7c20100ca 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c @@ -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) -- 2.11.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] iio: imu: inv_mpu6050: minor wording fixes 2018-05-01 17:56 ` [PATCH 1/2] iio: imu: inv_mpu6050: minor wording fixes Martin Kelly @ 2018-05-06 17:06 ` Jonathan Cameron 0 siblings, 0 replies; 9+ messages in thread From: Jonathan Cameron @ 2018-05-06 17:06 UTC (permalink / raw) To: Martin Kelly; +Cc: linux-iio, Jean-Baptiste Maneyrol On Tue, 1 May 2018 10:56:41 -0700 Martin Kelly <mkelly@xevo.com> wrote: > Just some minor grammar/spelling fixes of things I noticed while reading > the code. > > Signed-off-by: Martin Kelly <mkelly@xevo.com> 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 > --- > 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(-) > > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c > index aafa77766b08..59dbdeb08da4 100644 > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c > @@ -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 */ > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c > index 90fdc5eaef53..65dcb92be9f6 100644 > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c > @@ -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); > > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c > index e51404fdce97..0cb7c20100ca 100644 > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c > @@ -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) ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while 2018-05-01 17:56 [PATCH 0/2] inv_mpu6050 minor cleanup Martin Kelly 2018-05-01 17:56 ` [PATCH 1/2] iio: imu: inv_mpu6050: minor wording fixes Martin Kelly @ 2018-05-01 17:56 ` Martin Kelly 2018-05-06 17:08 ` Jonathan Cameron 1 sibling, 1 reply; 9+ messages in thread From: Martin Kelly @ 2018-05-01 17:56 UTC (permalink / raw) To: linux-iio; +Cc: Jean-Baptiste Maneyrol, Martin Kelly 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> --- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c index 0cb7c20100ca..11593deaaebd 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c @@ -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); -- 2.11.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while 2018-05-01 17:56 ` [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while Martin Kelly @ 2018-05-06 17:08 ` Jonathan Cameron 2018-05-08 14:34 ` Jean-Baptiste Maneyrol 0 siblings, 1 reply; 9+ messages in thread From: Jonathan Cameron @ 2018-05-06 17:08 UTC (permalink / raw) To: Martin Kelly; +Cc: linux-iio, Jean-Baptiste Maneyrol On Tue, 1 May 2018 10:56:42 -0700 Martin Kelly <mkelly@xevo.com> wrote: > 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> 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 > --- > drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c > index 0cb7c20100ca..11593deaaebd 100644 > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c > @@ -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); ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while 2018-05-06 17:08 ` Jonathan Cameron @ 2018-05-08 14:34 ` Jean-Baptiste Maneyrol 2018-05-12 9:04 ` Jonathan Cameron 0 siblings, 1 reply; 9+ messages in thread From: Jean-Baptiste Maneyrol @ 2018-05-08 14:34 UTC (permalink / raw) To: Jonathan Cameron, Martin Kelly; +Cc: linux-iio On 06/05/2018 19:08, Jonathan Cameron wrote: > On Tue, 1 May 2018 10:56:42 -0700 > Martin Kelly <mkelly@xevo.com> wrote: > >> 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> > 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 Hello, no problem for me, looks good. Anyway, I'm planning additionnal changes that are going to change completely this loop. JB > >> --- >> drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c >> index 0cb7c20100ca..11593deaaebd 100644 >> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c >> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c >> @@ -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); > > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while 2018-05-08 14:34 ` Jean-Baptiste Maneyrol @ 2018-05-12 9:04 ` Jonathan Cameron 2018-05-14 7:36 ` Jean-Baptiste Maneyrol 0 siblings, 1 reply; 9+ messages in thread From: Jonathan Cameron @ 2018-05-12 9:04 UTC (permalink / raw) To: Jean-Baptiste Maneyrol; +Cc: Martin Kelly, linux-iio On Tue, 8 May 2018 16:34:30 +0200 Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> wrote: > On 06/05/2018 19:08, Jonathan Cameron wrote: > > On Tue, 1 May 2018 10:56:42 -0700 > > Martin Kelly <mkelly@xevo.com> wrote: > > > >> 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> > > 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 > 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 > > JB > > > >> --- > >> drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- > >> 1 file changed, 2 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c > >> index 0cb7c20100ca..11593deaaebd 100644 > >> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c > >> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c > >> @@ -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); > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > > the body of a message to majordomo@vger.kernel.org > > 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 majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while 2018-05-12 9:04 ` Jonathan Cameron @ 2018-05-14 7:36 ` Jean-Baptiste Maneyrol 2018-05-14 18:38 ` Jonathan Cameron 0 siblings, 1 reply; 9+ messages in thread From: Jean-Baptiste Maneyrol @ 2018-05-14 7:36 UTC (permalink / raw) To: Jonathan Cameron; +Cc: Martin Kelly, linux-iio On 12/05/2018 11:04, Jonathan Cameron wrote: > 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. > > > On Tue, 8 May 2018 16:34:30 +0200 > Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> wrote: > >> On 06/05/2018 19:08, Jonathan Cameron wrote: >>> On Tue, 1 May 2018 10:56:42 -0700 >>> Martin Kelly <mkelly@xevo.com> wrote: >>> >>>> 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> >>> 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 >> 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 Hello Jonathan, it's strange, I can't find this patch in the testing branch. Is it expected? Thanks. JB > >> >> JB >>> >>>> --- >>>> drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- >>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c >>>> index 0cb7c20100ca..11593deaaebd 100644 >>>> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c >>>> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c >>>> @@ -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); >>> >>> -- >>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in >>> the body of a message to majordomo@vger.kernel.org >>> 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 majordomo@vger.kernel.org >> 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 majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while 2018-05-14 7:36 ` Jean-Baptiste Maneyrol @ 2018-05-14 18:38 ` Jonathan Cameron 0 siblings, 0 replies; 9+ messages in thread From: Jonathan Cameron @ 2018-05-14 18:38 UTC (permalink / raw) To: Jean-Baptiste Maneyrol; +Cc: Martin Kelly, linux-iio On 14 May 2018 08:36:58 BST, Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> wrote: > > >On 12/05/2018 11:04, Jonathan Cameron wrote: >> 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. >> >> >> On Tue, 8 May 2018 16:34:30 +0200 >> Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> wrote: >> >>> On 06/05/2018 19:08, Jonathan Cameron wrote: >>>> On Tue, 1 May 2018 10:56:42 -0700 >>>> Martin Kelly <mkelly@xevo.com> wrote: >>>> >>>>> 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> >>>> 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 >>> 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 >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. > >> >>> >>> JB >>>> >>>>> --- >>>>> drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- >>>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>>> >>>>> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c >b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c >>>>> index 0cb7c20100ca..11593deaaebd 100644 >>>>> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c >>>>> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c >>>>> @@ -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); >>>> >>>> -- >>>> To unsubscribe from this list: send the line "unsubscribe >linux-iio" in >>>> the body of a message to majordomo@vger.kernel.org >>>> 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 majordomo@vger.kernel.org >>> 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 majordomo@vger.kernel.org >> 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 majordomo@vger.kernel.org >More majordomo info at http://vger.kernel.org/majordomo-info.html -- Sent from my Android device with K-9 Mail. Please excuse my brevity. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-05-14 18:38 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-05-01 17:56 [PATCH 0/2] inv_mpu6050 minor cleanup Martin Kelly 2018-05-01 17:56 ` [PATCH 1/2] iio: imu: inv_mpu6050: minor wording fixes Martin Kelly 2018-05-06 17:06 ` Jonathan Cameron 2018-05-01 17:56 ` [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while Martin Kelly 2018-05-06 17:08 ` Jonathan Cameron 2018-05-08 14:34 ` Jean-Baptiste Maneyrol 2018-05-12 9:04 ` Jonathan Cameron 2018-05-14 7:36 ` Jean-Baptiste Maneyrol 2018-05-14 18:38 ` Jonathan Cameron
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.