dmaengine_p...nfig_sg_safe(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME πŸ’…

dmaengine_prep_config_sg_safe β€” bestie, this one prepares a scatter-gather DMA transfer and does an atomic slave configuration update at the same time ✨


✨ SYNOPSIS ✨

struct dma_async_tx_descriptor * dmaengine_prep_config_sg_safe (struct
dma_chan *chan , struct scatterlist *sgl , unsigned int sg_len , enum
dma_transfer_direction dir , unsigned long flags , struct
dma_slave_config *config );

πŸŽ€ ARGUMENTS πŸŽ€

  • chan β€” the DMA channel. your main character 🫢
  • sgl β€” the scatterlist for the transfer. it's giving "here's all the places the data lives" 🌈
  • sg_len β€” literally how many entries are in sgl. count 'em, don't guess πŸ’…
  • dir β€” the DMA transfer direction πŸ”₯
  • flags β€” transfer preparation flags ⭐
  • config β€” the DMA slave configuration for this transfer πŸ¦‹

🌸 DESCRIPTION 🌸

okay so picture this: you wanna prepare a DMA scatter-gather transfer, and you need the corresponding slave configuration update to happen with it β€” and you need the whole thing to be re-entrant and race-safe. that's the whole vibe. no cap πŸ’–

DMA engine drivers can implement the optional device_prep_config_sg callback to do both the slave configuration and the descriptor preparation atomically. if they do, the operation is fully handled by the DMA engine driver. iconic behavior, honestly πŸ‘‘

but if the DMA engine driver doesn't implement device_prep_config_sg, it falls back to calling dmaengine_slave_config followed by dmaengine_prep_slave_sg. and listen β€” that fallback path is protected by a per-channel spinlock, so concurrent callers can't interleave configuration and descriptor preparation on the same DMA channel. the way it just locks it down πŸ˜­πŸ”’


⭐ RETURN ⭐

You get a pointer to a prepared DMA async transaction descriptor on success β€” slay. Or NULL if the transfer could not be prepared. we don't love that, but we respect it πŸ™ˆ


πŸ¦‹ SEE ALSO πŸ¦‹

All of this lives in the kernel file ./include/linux/dmaengine.h, and it lowkey has the whole friend group with it:


and that's the page, bestie πŸŽ€ this lil entry comes straight out of the ./include/linux tree, October 2026, Kernel API Manual era β€” go forth and prep your scatter-gather transfers safely, ily, mwah πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from