Skip to content

iio: accel: bmc150: DMA-safe buffers and use iio_push_to_buffers_with_ts()

Yash Suthar linux-iio lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 9 repliesIn review
  2. v23 patches 8 repliesSuperseded
  3. v13 patches 5 repliesSuperseded

Changes in v3 from the cover letter

- 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

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3iio: accel: bmc150: use aligned scan buffer for both trigger and fifodrivers/iio/accel/bmc150-accel-core.c drivers/iio/accel/bmc150-accel.h+9 -131 reply
2/3iio: accel: bmc150: use DMA-safe buffers for regmap bulk readsdrivers/iio/accel/bmc150-accel-core.c drivers/iio/accel/bmc150-accel.h+11 -83 replies
3/3iio: accel: bmc150: use iio_push_to_buffers_with_ts()drivers/iio/accel/bmc150-accel-core.c+4 -44 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchAndy Shevchenko
1/3R-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/3] iio: accel: bmc150: DMA-safe buffers and use iio_push_to_buffers_with_ts()

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 to v1: https://lore.kernel.org/all/[email protected]/
Link to v2: https://lore.kernel.org/linux-iio/[email protected]/

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(-)
Signature · 1 line
2.43.0