diff options
Diffstat (limited to 'drivers/iio/proximity/srf08.c')
| -rw-r--r-- | drivers/iio/proximity/srf08.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c index 61866d0440f7..d7e4cc48cfbf 100644 --- a/drivers/iio/proximity/srf08.c +++ b/drivers/iio/proximity/srf08.c @@ -63,12 +63,6 @@ struct srf08_data { int range_mm; struct mutex lock; - /* Ensure timestamp is naturally aligned */ - struct { - s16 chan; - s64 timestamp __aligned(8); - } scan; - /* Sensor-Type */ enum srf08_sensor_type sensor_type; @@ -182,17 +176,19 @@ static irqreturn_t srf08_trigger_handler(int irq, void *p) struct iio_poll_func *pf = p; struct iio_dev *indio_dev = pf->indio_dev; struct srf08_data *data = iio_priv(indio_dev); - s16 sensor_data; + struct { + s16 chan; + aligned_s64 timestamp; + } scan = { }; - sensor_data = srf08_read_ranging(data); - if (sensor_data < 0) + scan.chan = srf08_read_ranging(data); + if (scan.chan < 0) goto err; mutex_lock(&data->lock); - data->scan.chan = sensor_data; - iio_push_to_buffers_with_timestamp(indio_dev, - &data->scan, pf->timestamp); + iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan), + pf->timestamp); mutex_unlock(&data->lock); err: @@ -531,7 +527,7 @@ static const struct of_device_id of_srf08_match[] = { { .compatible = "devantech,srf02", (void *)SRF02 }, { .compatible = "devantech,srf08", (void *)SRF08 }, { .compatible = "devantech,srf10", (void *)SRF10 }, - {}, + { } }; MODULE_DEVICE_TABLE(of, of_srf08_match); @@ -549,7 +545,7 @@ static struct i2c_driver srf08_driver = { .name = "srf08", .of_match_table = of_srf08_match, }, - .probe_new = srf08_probe, + .probe = srf08_probe, .id_table = srf08_id, }; module_i2c_driver(srf08_driver); |
