dmaengine_terminate_async(9)
π dmaengine_terminate_async β the Kernel API Manual, bestie edition β¨
okay so bestie, we're in the <pink>Kernel API Manual</pink> and today's main character is dmaengine_terminate_async. she cancels DMA transfers. that's her whole thing. let's get into it π
πΈ NAME πΈ
dmaengine_terminate_async β Terminate all active DMA transfers
β¨ SYNOPSIS β¨
int dmaengine_terminate_async (struct dma_chan *chan );
like, that's it. one function, one arg, returns an int. iconic behavior honestly π
π«Ά ARGUMENTS π«Ά
chanβ The channel for which to terminate the transfers. that's the one, the only, the channel you're ghosting π₯
π DESCRIPTION π
Calling this function will terminate all active and pending descriptors that have previously been submitted to the channel. so like, everything in the queue? gone. not me clearing the whole group chat π
But ngl, it's not guaranteed that the transfer for the active descriptor has actually stopped by the time the function returns. like she said "you're done" but the vibe is still loading π And furthermore β plot twist β it is possible that the complete callback of a submitted transfer is still running when this function returns. yes, really. the callback is still out there living its life π§
β οΈ so before you go freeing any memory that is accessed by previously submitted descriptors β or before freeing any resources accessed from within the completion callback of any previously submitted descriptors β dmaengine_synchronize needs to be called. no cap. that's the safe-to-free check. periodt.
The good news: this function can be called from atomic context as well as from within a complete callback of a descriptor submitted on the same channel. she's flexible like that π (iykyk, that's a very specific flex)
If none of the two conditions above apply, consider using dmaengine_terminate_sync instead. like, there's a whole other function for your situation, bestie, go get her π¦
π SEE ALSO π
- Kernel file
./include/linux/dmaengine.hβ that's the source of truth, go read her π dma_cookie_t(9)enum dma_status(9)enum dma_transaction_type(9)enum dma_transfer_direction(9)struct data_chunk(9)struct dma_interleaved_template(9)struct dma_vec(9)enum dma_ctrl_flags(9)enum sum_check_bits(9)enum sum_check_flags(9)enum dma_desc_metadata_mode(9)struct dma_chan_percpu(9)struct dma_router(9)struct dma_chan(9)struct dma_chan_dev(9)enum dma_slave_buswidth(9)struct dma_slave_config(9)enum dma_residue_granularity(9)struct dma_slave_caps(9)dma_filter_fn(9)struct dma_async_tx_descriptor(9)struct dma_tx_state(9)enum dmaengine_alignment(9)struct dma_slave_map(9)struct dma_filter(9)struct dma_device(9)dmaengine_prep_peripheral_dma_vec(9)dmaengine_prep_config_sg_safe(9)dmaengine_prep_config_single_safe(9)dmaengine_prep_dma_memset(9)dmaengine_terminate_all(9)dmaengine_synchronize(9)β the one you literally need, don't skip her π€dmaengine_terminate_sync(9)dma_async_issue_pending(9)dma_async_is_tx_complete(9)dma_async_is_complete(9)
that's a lot of cross-references and every single one of them is here because we don't gatekeep on this blog π
π bye bestie π
so anyway, this page lives in <purple>./include/linux</purple>, it's dated <cyan>October 2026</cyan>, and it's page <hotpink>dmaengine_terminate_async(9)</hotpink> of the Kernel API Manual. go call dmaengine_synchronize before you free anything, ily, mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms