]> www.infradead.org Git - users/hch/misc.git/commit
iio: dummy: Use a fixed structure to build up scan to push to buffers.
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 13 Apr 2025 10:34:29 +0000 (11:34 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 22 Apr 2025 18:10:04 +0000 (19:10 +0100)
commit451d5202ac50bed6a8f9b30dcad6c6eddec62a39
treea694f34781ade90ded66397b7d37a0f570417b1b
parentab0fbd0989755f4ac54f560f2170678fcd137f8f
iio: dummy: Use a fixed structure to build up scan to push to buffers.

It has long been discouraged for drivers to make use of iio_dev->scan_bytes
directly as that is an implementation detail of the core. As such our
example driver should definitely not be doing so.

In order to illustrate the more complex case, where a DMA safe buffer is
needed, continue to kzalloc() the storage (but with a structure definition
to provide an explicit data layout). Also add comments on when a DMA safe
buffer is necessary and the two common ways of obtaining one.

Whilst we have a mixture of signed and unsigned channels, the unsigned
channels have ranges that can be stored in a signed value - hence
use signed storage for all channels, simplifying the structure definition.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250413103443.2420727-7-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/dummy/iio_simple_dummy_buffer.c