diff options
author | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-06-13 18:10:36 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-10-19 10:29:22 +0300 |
commit | 95ec3fdf2b79eaff79e78688bbc2f7dbb98d68b6 (patch) | |
tree | 4598bda1dfb8da0720be05378da4391d1d1b83b5 /include/linux/iio/buffer.h | |
parent | b18831cc99426a9f6f085a29a53a423aa9b7c62e (diff) | |
download | linux-95ec3fdf2b79eaff79e78688bbc2f7dbb98d68b6.tar.xz |
iio: core: Introduce iio_push_to_buffers_with_ts_unaligned()
Whilst it is almost always possible to arrange for scan data to be
read directly into a buffer that is suitable for passing to
iio_push_to_buffers_with_timestamp(), there are a few places where
leading data needs to be skipped over.
For these cases introduce a function that will allocate an appropriate
sized and aligned bounce buffer (if not already allocated) and copy
the unaligned data into that before calling
iio_push_to_buffers_with_timestamp() on the bounce buffer.
We tie the lifespace of this buffer to that of the iio_dev.dev
which should ensure no memory leaks occur.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613151039.569883-2-jic23@kernel.org
Diffstat (limited to 'include/linux/iio/buffer.h')
-rw-r--r-- | include/linux/iio/buffer.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h index b6928ac5c63d..451379a3984a 100644 --- a/include/linux/iio/buffer.h +++ b/include/linux/iio/buffer.h @@ -38,6 +38,10 @@ static inline int iio_push_to_buffers_with_timestamp(struct iio_dev *indio_dev, return iio_push_to_buffers(indio_dev, data); } +int iio_push_to_buffers_with_ts_unaligned(struct iio_dev *indio_dev, + const void *data, size_t data_sz, + int64_t timestamp); + bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev, const unsigned long *mask); |