diff options
author | Vlad Dogaru <vlad.dogaru@intel.com> | 2015-05-13 15:30:08 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-05-17 11:24:36 +0200 |
commit | eb2191017e3063c7269be81e1543ccd157bb1e8b (patch) | |
tree | 3da09bb7b6df262fea4d1e1016916692ab5c4c54 /drivers/iio/gyro | |
parent | iio: __iio_update_buffers: Perform request_update() only for new buffers (diff) | |
download | linux-eb2191017e3063c7269be81e1543ccd157bb1e8b.tar.xz linux-eb2191017e3063c7269be81e1543ccd157bb1e8b.zip |
iio: gyro: bmg160: remove redundant field
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>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/gyro')
-rw-r--r-- | drivers/iio/gyro/bmg160.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/iio/gyro/bmg160.c b/drivers/iio/gyro/bmg160.c index 4415f55d26b6..d36af62ea230 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) { |