All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yash Suthar <yashsuthar983@gmail.com>
To: jic23@kernel.org
Cc: andriy.shevchenko@intel.com, andy@kernel.org,
	dlechner@baylibre.com, nuno.sa@analog.com,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: accel: bmc150: use IIO_DECLARE_BUFFER_WITH_TS
Date: Tue, 11 Aug 2026 03:28:00 +0530	[thread overview]
Message-ID: <20260810215800.55944-1-yashsuthar983@gmail.com> (raw)
In-Reply-To: <20260810001852.6afc2c2e@jic23-huawei>

On Mon, Aug 10, 2026 at 12:00:05PM +0300, Andy Shevchenko wrote:
> > So what is going on here?
>
> AI slop?

No. I only intended to convert buffer to IIO_DECLARE_BUFFER_WITH_TS() and dont
want to mix it with the existing scan member. Really sorry for that i should 
have asked.

On Mon, Aug 10, 2026 at 12:18:52AM +0100, Jonathan Cameron wrote:
> Given the data alignment is fixed, if we were going to do this it would
> be clearer as
> struct {
> 	s16 chans[3]; //see later, I believe this should be __le16
> 	aligned_s64 timestamp;
> };
>
> But that is very similar to the structure that follows immediately after
> this, but that has __le16 chans[]
>
> So what is going on here?
> ...
> The chan spec is little endian so the scan one is more correct.
>
> So I think the fix for this issue is move the scan element to the end of
> struct bmc150_accel_data and mark it with __aligned(IIO_DMA_MINALIGN);
>
> Then use that for both the bmc150_accel_trigger_handler() and
> __bmc150_accel_fifo_flush() paths.  A second fix will resolve the local
> buffer in __bmc150_accel_fifo_flush() that is being used for a bulk
> regmap transfer that may need a dma safe buffer.
>
> Please combine these two fixes (if you agree with my analysis) with a
> follow up to do the iio_push_to_buffers_with_ts() all in one series
> as they will be touching the same code.

Thanks, Jonathan.
I agree with your analysis.

On type, kept s16 because that was the originally used.
I'll keep __le16 and will merge buffer and scan together as you suggested.
Will move scan to the end with __aligned(IIO_DMA_MINALIGN) and use it for both
trigger handler and fifo flush.
A separate patch for the FIFO stack buffer and keep the
iio_push_to_buffers_with_ts() change in the same.

Yash Suthar

      parent reply	other threads:[~2026-08-10 21:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-08 22:02 [PATCH] iio: accel: bmc150: use IIO_DECLARE_BUFFER_WITH_TS Yash Suthar
2026-08-08 22:35 ` David Lechner
2026-08-09  5:54 ` [PATCH v2] " Yash Suthar
2026-08-09 22:59   ` Jonathan Cameron
2026-08-09 23:18     ` Jonathan Cameron
2026-08-10  9:00       ` Andy Shevchenko
2026-08-10 21:58       ` Yash Suthar [this message]

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=20260810215800.55944-1-yashsuthar983@gmail.com \
    --to=yashsuthar983@gmail.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.