]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: dma: add Coherent:init() and Coherent::init_with_attrs()
authorDanilo Krummrich <dakr@kernel.org>
Fri, 20 Mar 2026 19:45:40 +0000 (20:45 +0100)
committerDanilo Krummrich <dakr@kernel.org>
Mon, 23 Mar 2026 21:36:00 +0000 (22:36 +0100)
commit40251bac0e00818b0b632d2d154e4f1f815849eb
tree690280aba08687b5bda630533f22fa10cad1550f
parent80f4a7b5138d1c427ee5626e8a796aa6b2994a95
rust: dma: add Coherent:init() and Coherent::init_with_attrs()

Analogous to Coherent::zeroed() and Coherent::zeroed_with_attrs(), add
Coherent:init() and Coherent::init_with_attrs() which both take an impl
Init<T, E> argument initializing the DMA coherent memory.

Compared to CoherentInit, Coherent::init() is a one-shot constructor
that runs an Init closure and immediately exposes the DMA handle,
whereas CoherentInit is a multi-stage initializer that provides safe
&mut T access by withholding the DMA address until converted to
Coherent.

Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20260320194626.36263-6-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/dma.rs