linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Vlad Dogaru <vlad.dogaru@intel.com>,
	srinivas.pandruvada@linux.intel.com, irina.tirdea@intel.com,
	octavian.purdila@intel.com, linux-iio@vger.kernel.org
Cc: adriana.reus@intel.com
Subject: Re: [PATCH 1/2] iio: gyro: bmg160: remove redundant field
Date: Sun, 17 May 2015 10:25:50 +0100	[thread overview]
Message-ID: <55585E9E.8060404@kernel.org> (raw)
In-Reply-To: <1431523809-13824-2-git-send-email-vlad.dogaru@intel.com>

On 13/05/15 14:30, Vlad Dogaru wrote:
> Replace the 'timestamp' field in struct bmg160_data with the identically
> named field in iio_poll_func and with calls to iio_get_time_ns().
> 
> The reported timestamps may be slightly different, but the advantage is
> that we no longer assume that the buffer of bmg160 is triggered by its
> own trigger.
> 
> Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Your patch message rather undersells the advantages of this change but otherwise
a good change to make.  The timing difference will probably be very very small.

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

Thanks,

Jonathan
> ---
>  drivers/iio/gyro/bmg160.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iio/gyro/bmg160.c b/drivers/iio/gyro/bmg160.c
> index 4415f55..d36af62 100644
> --- a/drivers/iio/gyro/bmg160.c
> +++ b/drivers/iio/gyro/bmg160.c
> @@ -108,7 +108,6 @@ struct bmg160_data {
>  	int slope_thres;
>  	bool dready_trigger_on;
>  	bool motion_trigger_on;
> -	int64_t timestamp;
>  };
>  
>  enum bmg160_axis {
> @@ -835,7 +834,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)
>  	mutex_unlock(&data->mutex);
>  
>  	iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
> -					   data->timestamp);
> +					   pf->timestamp);
>  err:
>  	iio_trigger_notify_done(indio_dev->trig);
>  
> @@ -938,21 +937,21 @@ static irqreturn_t bmg160_event_handler(int irq, void *private)
>  							IIO_MOD_X,
>  							IIO_EV_TYPE_ROC,
>  							dir),
> -							data->timestamp);
> +							iio_get_time_ns());
>  	if (ret & BMG160_ANY_MOTION_BIT_Y)
>  		iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL,
>  							0,
>  							IIO_MOD_Y,
>  							IIO_EV_TYPE_ROC,
>  							dir),
> -							data->timestamp);
> +							iio_get_time_ns());
>  	if (ret & BMG160_ANY_MOTION_BIT_Z)
>  		iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL,
>  							0,
>  							IIO_MOD_Z,
>  							IIO_EV_TYPE_ROC,
>  							dir),
> -							data->timestamp);
> +							iio_get_time_ns());
>  
>  ack_intr_status:
>  	if (!data->dready_trigger_on) {
> @@ -973,8 +972,6 @@ static irqreturn_t bmg160_data_rdy_trig_poll(int irq, void *private)
>  	struct iio_dev *indio_dev = private;
>  	struct bmg160_data *data = iio_priv(indio_dev);
>  
> -	data->timestamp = iio_get_time_ns();
> -
>  	if (data->dready_trigger_on)
>  		iio_trigger_poll(data->dready_trig);
>  	else if (data->motion_trigger_on)
> @@ -1105,7 +1102,7 @@ static int bmg160_probe(struct i2c_client *client,
>  		}
>  
>  		ret = iio_triggered_buffer_setup(indio_dev,
> -						 NULL,
> +						 iio_pollfunc_store_time,
>  						 bmg160_trigger_handler,
>  						 NULL);
>  		if (ret < 0) {
> 


  reply	other threads:[~2015-05-17  9:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 13:30 [PATCH 0/2] iio: gyro: bmg160: decouple buffer from triggers Vlad Dogaru
2015-05-13 13:30 ` [PATCH 1/2] iio: gyro: bmg160: remove redundant field Vlad Dogaru
2015-05-17  9:25   ` Jonathan Cameron [this message]
2015-05-13 13:30 ` [PATCH 2/2] iio: gyro: bmg160: decouple buffer and triggers Vlad Dogaru
2015-05-17  9:27   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55585E9E.8060404@kernel.org \
    --to=jic23@kernel.org \
    --cc=adriana.reus@intel.com \
    --cc=irina.tirdea@intel.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=octavian.purdila@intel.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=vlad.dogaru@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).