Re: [PATCH v2] iio: adc: ti-ads7950: use iio_push_to_buffers_with_ts_unaligned()

Andy Shevchenko
2026-03-16T11:27:02Z

On Sat, Mar 14, 2026 at 04:12:24PM -0500, David Lechner wrote:
> Use iio_push_to_buffers_with_ts_unaligned() to avoid unaligned access
> when writing the timestamp in the rx_buf.
>
> The previous implementation would have been fine on architectures that
> support 4-byte alignment of 64-bit integers but could cause issues on
> architectures that require 8-byte alignment.

...

> + u16 rx_buf[TI_ADS7950_MAX_CHAN + 2] __aligned(IIO_DMA_MINALIGN);
> u16 tx_buf[TI_ADS7950_MAX_CHAN + 2];

...

> - iio_push_to_buffers_with_timestamp(indio_dev, &st->rx_buf[2],
> - iio_get_time_ns(indio_dev));
> + iio_push_to_buffers_with_ts_unaligned(indio_dev, &st->rx_buf[2],
> + sizeof(*st->rx_buf) *
> + TI_ADS7950_MAX_CHAN,

Hmm... Wouldn't this benefit from array_size() macro?

> + iio_get_time_ns(indio_dev));

--
With Best Regards,
Andy Shevchenko