+static irqreturn_t rm3100_trigger_handler(int irq, void *p)Firstly X doesn't need copying.
+{
+ struct iio_poll_func *pf = p;
+ struct iio_dev *indio_dev = pf->indio_dev;
+ struct rm3100_data *data = iio_priv(indio_dev);
+ struct regmap *regmap = data->regmap;
+ u8 buffer[9];
+ int ret;
+ int i;
+
+ mutex_lock(&data->lock);
+ ret = rm3100_wait_measurement(data);
+ if (ret < 0) {
+ mutex_unlock(&data->lock);
+ goto done;
+ }
+
+ ret = regmap_bulk_read(regmap, RM3100_REG_MX2, buffer, sizeof(buffer));
+ mutex_unlock(&data->lock);
+ if (ret < 0)
+ goto done;
+
+ /* Convert XXXYYYZZZxxx to XXXxYYYxZZZx. x for padding. */
+ for (i = 0; i < 3; i++)
+ memcpy(data->buffer + i * 4, buffer + i * 3, 3);
Secondly the copy of Y actually overwrites the value of Z
XXXYYYZZZxxx
XXXxYYYZZxxx
XXXxYYYxYZZx
I think...
+
+ iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
+ iio_get_time_ns(indio_dev));