Re: [PATCH v3 1/3] iio: accel: bmc150: use aligned scan buffer for both trigger and fifo

From: Andy Shevchenko

Date: Thu Aug 27 2026 - 02:57:59 EST


On Tue, Aug 25, 2026 at 02:21:54PM +0530, Yash Suthar wrote:
> Drop buffer as duplicate and s16 is not correct we needed __le16 as little
> endian, keep scan at the end of the bmc150_accel_data struct with
> IIO_DMA_MINALIGN, and use it for both paths.
>
> In trigger handle, replaced AXIS_MAX with sizeof(data->scan.channels).
> Additionally, ensure mutex is held across both read and push to get
> DMA safety for the scan buffer.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>

...

> mutex_lock(&data->mutex);
> ret = regmap_bulk_read(data->regmap, BMC150_ACCEL_REG_XOUT_L,
> - data->buffer, AXIS_MAX * 2);
> - mutex_unlock(&data->mutex);

> + data->scan.channels,
> + sizeof(data->scan.channels));

I would put this on a single line (it is 81 characters only).

> if (ret < 0)
> goto err_read;
>
> - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
> + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
> pf->timestamp);

I would put this on a single line (it is 82 characters only).

> err_read:
> + mutex_unlock(&data->mutex);
> iio_trigger_notify_done(indio_dev->trig);

--
With Best Regards,
Andy Shevchenko