summaryrefslogtreecommitdiff
path: root/include/linux/iio/buffer-dmaengine.h
diff options
context:
space:
mode:
authorDavid Lechner <dlechner@baylibre.com>2025-02-07 23:09:05 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2025-02-10 21:47:29 +0300
commit4fe7fd17fe66a5e243c1de7ff32c29fac7039b8d (patch)
treec6d4718ac752bf56a50eea07e937f9986a80d472 /include/linux/iio/buffer-dmaengine.h
parenta570114db8ead2e0d90a63888b8e269878ab502f (diff)
downloadlinux-4fe7fd17fe66a5e243c1de7ff32c29fac7039b8d.tar.xz
iio: buffer-dmaengine: split requesting DMA channel from allocating buffer
Refactor the IIO dmaengine buffer code to split requesting the DMA channel from allocating the buffer. We want to be able to add a new function where the IIO device driver manages the DMA channel, so these two actions need to be separate. To do this, calling dma_request_chan() is moved from iio_dmaengine_buffer_alloc() to iio_dmaengine_buffer_setup_ext(). A new __iio_dmaengine_buffer_setup_ext() helper function is added to simplify error unwinding and will also be used by a new function in a later patch. iio_dmaengine_buffer_free() now only frees the buffer and does not release the DMA channel. A new iio_dmaengine_buffer_teardown() function is added to unwind everything done in iio_dmaengine_buffer_setup_ext(). This keeps things more symmetrical with obvious pairs alloc/free and setup/teardown. Calling dma_get_slave_caps() in iio_dmaengine_buffer_alloc() is moved so that we can avoid any gotos for error unwinding. Reviewed-by: Nuno Sa <nuno.sa@analog.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250207-dlech-mainline-spi-engine-offload-2-v8-8-e48a489be48c@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'include/linux/iio/buffer-dmaengine.h')
-rw-r--r--include/linux/iio/buffer-dmaengine.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/iio/buffer-dmaengine.h b/include/linux/iio/buffer-dmaengine.h
index 81d9a19aeb91..72a2e3fd8a5b 100644
--- a/include/linux/iio/buffer-dmaengine.h
+++ b/include/linux/iio/buffer-dmaengine.h
@@ -12,7 +12,7 @@
struct iio_dev;
struct device;
-void iio_dmaengine_buffer_free(struct iio_buffer *buffer);
+void iio_dmaengine_buffer_teardown(struct iio_buffer *buffer);
struct iio_buffer *iio_dmaengine_buffer_setup_ext(struct device *dev,
struct iio_dev *indio_dev,
const char *channel,