Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Nuno Sá and committed by
Jonathan Cameron
a0dcec6a 0c1316b9

+5 -7
+5 -7
drivers/iio/buffer/industrialio-buffer-dmaengine.c
··· 6 6 7 7 #include <linux/slab.h> 8 8 #include <linux/kernel.h> 9 + #include <linux/cleanup.h> 9 10 #include <linux/dmaengine.h> 10 11 #include <linux/dma-mapping.h> 11 12 #include <linux/spinlock.h> ··· 50 49 const struct dmaengine_result *result) 51 50 { 52 51 struct iio_dma_buffer_block *block = data; 53 - unsigned long flags; 54 52 55 - spin_lock_irqsave(&block->queue->list_lock, flags); 56 - list_del(&block->head); 57 - spin_unlock_irqrestore(&block->queue->list_lock, flags); 53 + scoped_guard(spinlock_irqsave, &block->queue->list_lock) 54 + list_del(&block->head); 58 55 block->bytes_used -= result->residue; 59 56 iio_dma_buffer_block_done(block); 60 57 } ··· 130 131 if (dma_submit_error(cookie)) 131 132 return dma_submit_error(cookie); 132 133 133 - spin_lock_irq(&dmaengine_buffer->queue.list_lock); 134 - list_add_tail(&block->head, &dmaengine_buffer->active); 135 - spin_unlock_irq(&dmaengine_buffer->queue.list_lock); 134 + scoped_guard(spinlock_irq, &dmaengine_buffer->queue.list_lock) 135 + list_add_tail(&block->head, &dmaengine_buffer->active); 136 136 137 137 dma_async_issue_pending(dmaengine_buffer->chan); 138 138