diff mbox

iio: imu: inv_mpu6050: do not flush fifo when iio buffer is full

Message ID 1523607906-22485-1-git-send-email-jmaneyrol@invensense.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jean-Baptiste Maneyrol April 13, 2018, 8:25 a.m. UTC
There is no need to flush fifo and loose all data when the iio
buffer is full. Just drop the data by ignoring the error as
commonly done in other drivers.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Martin Kelly April 14, 2018, 6 p.m. UTC | #1
On 04/13/2018 01:25 AM, Jean-Baptiste Maneyrol wrote:
> There is no need to flush fifo and loose all data when the iio
> buffer is full. Just drop the data by ignoring the error as
> commonly done in other drivers.
> 
> Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
> ---
>   drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> index ff81c6a..27c663c 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> @@ -170,10 +170,8 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
>   		if (result == 0)
>   			timestamp = 0;
>   
> -		result = iio_push_to_buffers_with_timestamp(indio_dev, data,
> -							    timestamp);
> -		if (result)
> -			goto flush_fifo;
> +		iio_push_to_buffers_with_timestamp(indio_dev, data, timestamp);
> +
>   		fifo_count -= bytes_per_datum;
>   	}
>   
> 

Reviewed-by: Martin Kelly <martin@martingkelly.com>

I wondered the same thing as I was reading this code :).
--
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
Jonathan Cameron April 15, 2018, 5:07 p.m. UTC | #2
On Sat, 14 Apr 2018 11:00:07 -0700
Martin Kelly <martin@martingkelly.com> wrote:

> On 04/13/2018 01:25 AM, Jean-Baptiste Maneyrol wrote:
> > There is no need to flush fifo and loose all data when the iio
> > buffer is full. Just drop the data by ignoring the error as
> > commonly done in other drivers.
> > 
> > Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
> > ---
> >   drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 6 ++----
> >   1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> > index ff81c6a..27c663c 100644
> > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> > @@ -170,10 +170,8 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
> >   		if (result == 0)
> >   			timestamp = 0;
> >   
> > -		result = iio_push_to_buffers_with_timestamp(indio_dev, data,
> > -							    timestamp);
> > -		if (result)
> > -			goto flush_fifo;
> > +		iio_push_to_buffers_with_timestamp(indio_dev, data, timestamp);
> > +
> >   		fifo_count -= bytes_per_datum;
> >   	}
> >   
> >   
> 
> Reviewed-by: Martin Kelly <martin@martingkelly.com>
> 
> I wondered the same thing as I was reading this code :).

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan

> --
> 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
diff mbox

Patch

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
index ff81c6a..27c663c 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
@@ -170,10 +170,8 @@  irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
 		if (result == 0)
 			timestamp = 0;
 
-		result = iio_push_to_buffers_with_timestamp(indio_dev, data,
-							    timestamp);
-		if (result)
-			goto flush_fifo;
+		iio_push_to_buffers_with_timestamp(indio_dev, data, timestamp);
+
 		fifo_count -= bytes_per_datum;
 	}