Re: [PATCH v2 2/2] iio: accel: kionix-kx022a: use iio_push_to_buffers_with_ts()
Jonathan Cameron <[email protected]>
| Newsgroups | org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260820031119.47cc45b0@jic23-huawei> |
On Wed, 19 Aug 2026 08:11:45 +0300 Matti Vaittinen <[email protected]> wrote: > On 19/08/2026 00:51, Gabriel Rondon wrote: > > Replace the deprecated iio_push_to_buffers_with_timestamp() with > > iio_push_to_buffers_with_ts(), which takes the destination buffer size > > and checks it against scan_bytes at runtime. > > > > Both push sites now use data->scan ({ __le16 channels[3]; aligned_s64 > > ts; }, IIO_DMA_MINALIGN aligned), which is 16 bytes and matches > > scan_bytes for the 3-axis plus s64 timestamp layout used by all > > supported variants, so pass sizeof(data->scan). > > Eh, what is this explanation above? As far as I understand, the > iio_push_to_buffers_with_ts() has a safety mechanism of checking the > passed buffer size. So, size of the buffer must be passed, no matter > what the buffer is designed to contain. Fair point - this evolved in an odd direction. Dropped that paragraph. > > By the way, to my eye the commit message looks AI generated, which is > perfectly fine. But AFAICS, AI generated patches should be tagged as AI > generated. Hence, if you use AI to do the changes, please ask the AI to > check the docs and also add necessary tags :) > > > Signed-off-by: Gabriel Rondon <[email protected]> > > Other than the commit message: > Reviewed-by: Matti Vaittinen <[email protected]> > > > --- > > drivers/iio/accel/kionix-kx022a.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c > > index cf2cb751b4e8..86f17431aa23 100644 > > --- a/drivers/iio/accel/kionix-kx022a.c > > +++ b/drivers/iio/accel/kionix-kx022a.c > > @@ -863,7 +863,8 @@ static int __kx022a_fifo_flush(struct iio_dev *idev, unsigned int samples, > > for_each_set_bit(bit, idev->active_scan_mask, AXIS_MAX) > > chs[bit] = sam[bit]; > > > > - iio_push_to_buffers_with_timestamp(idev, &data->scan, tstamp); > > + iio_push_to_buffers_with_ts(idev, &data->scan, > > + sizeof(data->scan), tstamp); > > > > tstamp += sample_period; > > } > > @@ -1033,7 +1034,8 @@ static irqreturn_t kx022a_trigger_handler(int irq, void *p) > > if (ret < 0) > > goto err_read; > > > > - iio_push_to_buffers_with_timestamp(idev, &data->scan, data->timestamp); > > + iio_push_to_buffers_with_ts(idev, &data->scan, sizeof(data->scan), > > + data->timestamp); > > err_read: > > iio_trigger_notify_done(idev->trig); > > > >