Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754281AbbBZSkY (ORCPT ); Thu, 26 Feb 2015 13:40:24 -0500 Received: from email.invensense.com ([12.199.206.106]:28950 "EHLO email.invensense.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754058AbbBZSkS convert rfc822-to-8bit (ORCPT ); Thu, 26 Feb 2015 13:40:18 -0500 X-Greylist: delayed 308 seconds by postgrey-1.27 at vger.kernel.org; Thu, 26 Feb 2015 13:40:18 EST From: Ge Gao To: Jonathan Cameron , Viorel Suman , "linux-iio@vger.kernel.org" CC: "linux-kernel@vger.kernel.org" , "Srinivas Pandruvada" Subject: RE: [PATCH v2] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo Thread-Topic: [PATCH v2] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo Thread-Index: AQHQTgilXONhVGpXNEGCqho4uhLYoZ0DSd4Q Date: Thu, 26 Feb 2015 18:35:40 +0000 Message-ID: References: <1424282721-3033-1-git-send-email-viorel.suman@gmail.com> <54E8D5D7.7050205@kernel.org> In-Reply-To: <54E8D5D7.7050205@kernel.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.26.103.80] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2828 Lines: 90 Look fine to me. Thanks. Best Regards, Ge GAO -----Original Message----- From: Jonathan Cameron [mailto:jic23@kernel.org] Sent: Saturday, February 21, 2015 11:01 AM To: Viorel Suman; linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org; Srinivas Pandruvada; Ge Gao Subject: Re: [PATCH v2] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo On 18/02/15 18:05, Viorel Suman wrote: > A hardware fifo reset always imply an invalidation of the existing > timestamps, so we'll clear timestamps fifo on successfull hardware > fifo reset. > > Signed-off-by: Viorel Suman Looks sensible to me. Ge / Srinivas? > --- > v2: Addressed Jonathan's comment regarding the subject prefix. > > drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 25 > ++++++++++++++----------- > 1 file changed, 14 insertions(+), 11 deletions(-) > > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c > b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c > index 0cd306a..ba27e27 100644 > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c > @@ -24,6 +24,16 @@ > #include > #include "inv_mpu_iio.h" > > +static void inv_clear_kfifo(struct inv_mpu6050_state *st) { > + unsigned long flags; > + > + /* take the spin lock sem to avoid interrupt kick in */ > + spin_lock_irqsave(&st->time_stamp_lock, flags); > + kfifo_reset(&st->timestamps); > + spin_unlock_irqrestore(&st->time_stamp_lock, flags); } > + > int inv_reset_fifo(struct iio_dev *indio_dev) { > int result; > @@ -50,6 +60,10 @@ int inv_reset_fifo(struct iio_dev *indio_dev) > INV_MPU6050_BIT_FIFO_RST); > if (result) > goto reset_fifo_fail; > + > + /* clear timestamps fifo */ > + inv_clear_kfifo(st); > + > /* enable interrupt */ > if (st->chip_config.accl_fifo_enable || > st->chip_config.gyro_fifo_enable) { @@ -83,16 +97,6 @@ > reset_fifo_fail: > return result; > } > > -static void inv_clear_kfifo(struct inv_mpu6050_state *st) -{ > - unsigned long flags; > - > - /* take the spin lock sem to avoid interrupt kick in */ > - spin_lock_irqsave(&st->time_stamp_lock, flags); > - kfifo_reset(&st->timestamps); > - spin_unlock_irqrestore(&st->time_stamp_lock, flags); > -} > - > /** > * inv_mpu6050_irq_handler() - Cache a timestamp at each data ready interrupt. > */ > @@ -184,7 +188,6 @@ end_session: > flush_fifo: > /* Flush HW and SW FIFOs. */ > inv_reset_fifo(indio_dev); > - inv_clear_kfifo(st); > mutex_unlock(&indio_dev->mlock); > iio_trigger_notify_done(indio_dev->trig); > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/