diff options
| author | Nuno Sá <nuno.sa@analog.com> | 2025-12-19 15:28:16 +0000 |
|---|---|---|
| committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2025-12-21 12:01:00 +0000 |
| commit | a0dcec6aa8ced73edf9c72a853218d56035770ab (patch) | |
| tree | 36db4a756e30ff1913b5a1dc00ecf1980df0e43d /drivers/iio/buffer | |
| parent | 0c1316b9521af0801e2502f390a89df5459094ed (diff) | |
| download | lwn-a0dcec6aa8ced73edf9c72a853218d56035770ab.tar.gz lwn-a0dcec6aa8ced73edf9c72a853218d56035770ab.zip | |
iio: buffer-dmaengine: Use the cleanup.h API
Make use of the cleanup.h API for locks in order to simplify some code
paths.
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/buffer')
| -rw-r--r-- | drivers/iio/buffer/industrialio-buffer-dmaengine.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/iio/buffer/industrialio-buffer-dmaengine.c b/drivers/iio/buffer/industrialio-buffer-dmaengine.c index 27dd56334345..750bd3f3fd4a 100644 --- a/drivers/iio/buffer/industrialio-buffer-dmaengine.c +++ b/drivers/iio/buffer/industrialio-buffer-dmaengine.c @@ -6,6 +6,7 @@ #include <linux/slab.h> #include <linux/kernel.h> +#include <linux/cleanup.h> #include <linux/dmaengine.h> #include <linux/dma-mapping.h> #include <linux/spinlock.h> @@ -49,11 +50,9 @@ static void iio_dmaengine_buffer_block_done(void *data, const struct dmaengine_result *result) { struct iio_dma_buffer_block *block = data; - unsigned long flags; - spin_lock_irqsave(&block->queue->list_lock, flags); - list_del(&block->head); - spin_unlock_irqrestore(&block->queue->list_lock, flags); + scoped_guard(spinlock_irqsave, &block->queue->list_lock) + list_del(&block->head); block->bytes_used -= result->residue; iio_dma_buffer_block_done(block); } @@ -131,9 +130,8 @@ static int iio_dmaengine_buffer_submit_block(struct iio_dma_buffer_queue *queue, if (dma_submit_error(cookie)) return dma_submit_error(cookie); - spin_lock_irq(&dmaengine_buffer->queue.list_lock); - list_add_tail(&block->head, &dmaengine_buffer->active); - spin_unlock_irq(&dmaengine_buffer->queue.list_lock); + scoped_guard(spinlock_irq, &dmaengine_buffer->queue.list_lock) + list_add_tail(&block->head, &dmaengine_buffer->active); dma_async_issue_pending(dmaengine_buffer->chan); |
