Re: [PATCH v2] iio: adc: ti-ads7950: use iio_push_to_buffers_with_ts_unaligned()
From: Dmitry Torokhov
Date: Sun Mar 22 2026 - 18:30:34 EST
On Sat, Mar 21, 2026 at 09:05:39PM +0000, Jonathan Cameron wrote:
> On Sat, 14 Mar 2026 16:12:24 -0500
> David Lechner <dlechner@xxxxxxxxxxxx> 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.
> >
> > Fixes: 902c4b2446d4 ("iio: adc: New driver for TI ADS7950 chips")
> > Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx>
> > ---
> > Since we were looking at this driver, I was going to convert this to use
> > IIO_DECLARE_DMA_BUFFER_WITH_TS() but then I noticed that we actually
> > have an unaligned access problem with the timestamp since we are
> > ignoring the first two elements in the rx_buf when pushing the data to
> > the buffer.
> >
> > Unfortunately, this will cause a merge conflict with the series Dmitry
> > is working on. I don't think there is any rush to get this backported
> > since no one has reported a crash from unaligned access. Since fixes
> > should go before improvements, we could apply this to iio/togreg then
> > Dmitry can rebase his series on top of it.
> I've done that. Applied to the togreg branch of iio.git pushed out as
> testing etc. I've also marked it for stable so it gets picked up in the long
> run.
Cool, I'll rebase and send out my patches as soon as this hits
linux-next.
Thanks.
--
Dmitry