mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: adc: ti-ads7950: use iio_push_to_buffers_with_ts_unaligned()
Date: Mon, 16 Mar 2026 09:58:47 -0500	[thread overview]
Message-ID: <f08de112-db5f-483a-bfb7-9e928c3107fd@baylibre.com> (raw)
In-Reply-To: <abfpAcN3qDKe4zdd@ashevche-desk.local>

On 3/16/26 6:26 AM, Andy Shevchenko wrote:
> 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?

I don't think so. This is a compile-time constant. array_size() is
a function that handles overflow, and there is no risk of overflow
since it is a constant.

> 
>> +					      iio_get_time_ns(indio_dev));
> 


  reply	other threads:[~2026-03-16 14:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-14 21:12 David Lechner
2026-03-16 11:26 ` Andy Shevchenko
2026-03-16 14:58   ` David Lechner [this message]
2026-03-21 21:05 ` Jonathan Cameron
2026-03-22 22:30   ` Dmitry Torokhov
2026-03-25 14:56     ` Dmitry Torokhov
2026-03-25 20:39       ` Jonathan Cameron

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=f08de112-db5f-483a-bfb7-9e928c3107fd@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dmitry.torokhov@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

all inboxes | Powered by JetHome®