From: Md Shofiqul Islam <shofiqtest@gmail.com>
To: stepan.ionichev@gmail.com
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH v2] iio: accel: adxl372: Add timestamp to FIFO data
Date: Sun, 17 May 2026 02:19:25 -0700 (PDT) [thread overview]
Message-ID: <6a09881d.8a1109d5.2659dd.6b1c@mx.google.com> (raw)
In-Reply-To: <20260516211935.36773-1-shofiqtest@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 949 bytes --]
Hi Stepan,
Thank you for the careful analysis. You are correct -- iio_push_to_buffers_with_ts()
writes the s64 timestamp into the source buffer at offset ALIGN(data_sz - 8, 8),
which in the FIFO drain loop means the write lands in data that has not been
consumed by the next iteration yet. This is indeed a data corruption bug.
v3 switches to iio_push_to_buffers_with_ts_unaligned() which copies the sample
into an internal bounce buffer before adding the timestamp, leaving fifo_buf[]
untouched across iterations. The size argument stays as
st->fifo_set_size * sizeof(__be16) -- the actual per-sample data size -- which
_unaligned() clamps internally to min(scan_bytes, data_sz).
The fix and the explanation of why _unaligned() is needed are in the commit
message of v3:
[PATCH v3] iio: accel: adxl372: Add timestamp to FIFO data
Message-ID: <20260517091735.135610-1-shofiqtest@gmail.com>
Thanks again for catching this.
Md Shofiqul Islam
prev parent reply other threads:[~2026-05-17 9:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-16 21:19 [PATCH v2] iio: accel: adxl372: Add timestamp to FIFO data Md Shofiqul Islam
2026-05-16 23:35 ` David Lechner
2026-05-16 23:36 ` David Lechner
2026-05-17 7:14 ` Stepan Ionichev
2026-05-17 9:17 ` [PATCH v3] " Md Shofiqul Islam
2026-05-17 9:19 ` [PATCH v2] " Md Shofiqul Islam
2026-05-17 12:57 ` Jonathan Cameron
2026-05-17 9:19 ` Md Shofiqul Islam [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=6a09881d.8a1109d5.2659dd.6b1c@mx.google.com \
--to=shofiqtest@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=stepan.ionichev@gmail.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