[PATCH 1/3] dmaengine: Use non-atomic bit ops for cap_mask manipulation

From: Peng Fan (OSS)

Date: Thu Sep 03 2026 - 11:16:32 EST


From: Peng Fan <peng.fan@xxxxxxx>

dma_cap_set() and dma_cap_clear() are called exclusively during driver
probe, before dma_async_device_register() makes the device visible to
the rest of the system. There is no concurrent access to cap_mask at
that point, so switch to the non-atomic __set_bit()/__clear_bit()
equivalents.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
---
include/linux/dmaengine.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index fe33a20abc614..923d914691d06 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1551,14 +1551,14 @@ static inline bool async_tx_test_ack(struct dma_async_tx_descriptor *tx)
static inline void
__dma_cap_set(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp)
{
- set_bit(tx_type, dstp->bits);
+ __set_bit(tx_type, dstp->bits);
}

#define dma_cap_clear(tx, mask) __dma_cap_clear((tx), &(mask))
static inline void
__dma_cap_clear(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp)
{
- clear_bit(tx_type, dstp->bits);
+ __clear_bit(tx_type, dstp->bits);
}

#define dma_cap_zero(mask) __dma_cap_zero(&(mask))

--
2.34.1