Linux IIO development
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Gabriel Rondon <grondon@gmail.com>, Jonathan Cameron <jic23@kernel.org>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] iio: accel: kionix-kx022a: use iio_push_to_buffers_with_ts()
Date: Wed, 19 Aug 2026 08:11:45 +0300	[thread overview]
Message-ID: <c4606bde-6132-4407-9fcf-32ec35b1ed1c@gmail.com> (raw)
In-Reply-To: <20260818215122.52715-3-grondon@gmail.com>

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.

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 <grondon@gmail.com>

Other than the commit message:
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>

> ---
>   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);
>   


-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

  reply	other threads:[~2026-08-19  5:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 21:51 [PATCH v2 0/2] iio: accel: kionix-kx022a: unify staging buffer and convert to iio_push_to_buffers_with_ts() Gabriel Rondon
2026-08-18 21:51 ` [PATCH v2 1/2] iio: accel: kionix-kx022a: use scan struct for one-shot and trigger reads Gabriel Rondon
2026-08-19  4:59   ` Matti Vaittinen
2026-08-19  7:17   ` Andy Shevchenko
2026-08-18 21:51 ` [PATCH v2 2/2] iio: accel: kionix-kx022a: use iio_push_to_buffers_with_ts() Gabriel Rondon
2026-08-19  5:11   ` Matti Vaittinen [this message]
2026-08-19  0:09 ` [PATCH v2 0/2] iio: accel: kionix-kx022a: unify staging buffer and convert to iio_push_to_buffers_with_ts() Jonathan Cameron
2026-08-19  5:15   ` Matti Vaittinen
2026-08-19  7:18     ` Andy Shevchenko
2026-08-19  7:19 ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4606bde-6132-4407-9fcf-32ec35b1ed1c@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=grondon@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox