Linux IIO development
 help / color / mirror / Atom feed
* [PATCH v3 0/3] iio: accel: bmc150: DMA-safe buffers and use iio_push_to_buffers_with_ts()
@ 2026-08-25  8:51 Yash Suthar
  2026-08-25  8:51 ` [PATCH v3 1/3] iio: accel: bmc150: use aligned scan buffer for both trigger and fifo Yash Suthar
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Yash Suthar @ 2026-08-25  8:51 UTC (permalink / raw)
  To: jic23
  Cc: dlechner, nuno.sa, andy, andriy.shevchenko, grondon, linusw,
	hexlabsecurity, sakari.ailus, srinivas.pandruvada, linux-iio,
	linux-kernel, Yash Suthar

The trigger path used a plain s16 buffer while the FIFO path already had
a properly typed scan member (__le16 + aligned timestamp). Those two
buffers did the same job, and s16 does not represent little-endian data.
Drop the duplicate, keep scan at the end of struct bmc150_accel_data with
IIO_DMA_MINALIGN, and use it for both the trigger and FIFO paths.

The FIFO and read_raw buffers are passed to regmap bulk/raw reads, which
is not DMA-safe. Move them into struct bmc150_accel_data after the aligned
scan buffer. Because all buffers are serialized by data->mutex, placing
them after scan ensures DMA safety without needing separate alignment.

Finally, replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts() so the push sites pass an explicit buffer
size.

This supersedes the earlier standalone patches:
Link: https://lore.kernel.org/linux-iio/20260808220236.421832-1-yashsuthar983@gmail.com/
Link: https://lore.kernel.org/linux-iio/20260809111303.496393-1-yashsuthar983@gmail.com/

Link to v1: https://lore.kernel.org/all/20260814101845.301769-1-yashsuthar983@gmail.com/
Link to v2: https://lore.kernel.org/linux-iio/20260815175728.99541-1-yashsuthar983@gmail.com/

Changes in v3:
- patch 1: hold mutex for both the read and push to guarantee DMA safety
- patch 1: drop unused AXIS_MAX and use sizeof(data->scan.channels)
- patch 2: remove redundant __aligned(IIO_DMA_MINALIGN) from fifo_buff 
  and regval, as the mutex serializes access
- patch 2: fix comma typo in commit message

Changes in v2:
- patch 1: restore early error check flow
- patch 2: keep fifo_buff declaration in one line

Yash Suthar (3):
  iio: accel: bmc150: use aligned scan buffer for both trigger and fifo
  iio: accel: bmc150: use DMA-safe buffers for regmap bulk reads
  iio: accel: bmc150: use iio_push_to_buffers_with_ts()

 drivers/iio/accel/bmc150-accel-core.c | 28 +++++++++++++--------------
 drivers/iio/accel/bmc150-accel.h      | 19 +++++++++---------
 2 files changed, 23 insertions(+), 24 deletions(-)

-- 
2.43.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-08-27  7:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25  8:51 [PATCH v3 0/3] iio: accel: bmc150: DMA-safe buffers and use iio_push_to_buffers_with_ts() Yash Suthar
2026-08-25  8:51 ` [PATCH v3 1/3] iio: accel: bmc150: use aligned scan buffer for both trigger and fifo Yash Suthar
2026-08-27  6:57   ` Andy Shevchenko
2026-08-25  8:51 ` [PATCH v3 2/3] iio: accel: bmc150: use DMA-safe buffers for regmap bulk reads Yash Suthar
2026-08-27  7:05   ` Andy Shevchenko
2026-08-25  8:51 ` [PATCH v3 3/3] iio: accel: bmc150: use iio_push_to_buffers_with_ts() Yash Suthar
2026-08-27  7:08   ` Andy Shevchenko
2026-08-27  6:52 ` [PATCH v3 0/3] iio: accel: bmc150: DMA-safe buffers and " Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox