[PATCH 8/9] rust: dma: add CoherentObject for single element allocations

From: Eliot Courtney

Date: Fri Jan 30 2026 - 03:36:25 EST


Add a type alias for convenience and readability for single element
allocations.

Signed-off-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
---
rust/kernel/dma.rs | 3 +++
1 file changed, 3 insertions(+)

diff --git a/rust/kernel/dma.rs b/rust/kernel/dma.rs
index 25da678c863b..120fc01e57a3 100644
--- a/rust/kernel/dma.rs
+++ b/rust/kernel/dma.rs
@@ -423,6 +423,9 @@ pub struct CoherentAllocation<T: AsBytes + FromBytes, Size: AllocationSize = Run
/// A coherent DMA allocation for an array of `N` elements.
pub type CoherentArray<T, const N: usize> = CoherentAllocation<T, StaticSize<N>>;

+/// A coherent DMA allocation for a single object.
+pub type CoherentObject<T> = CoherentAllocation<T, StaticSize<1>>;
+
impl<T: AsBytes + FromBytes, Size: AllocationSize> CoherentAllocation<T, Size> {
/// Returns the number of elements `T` in this allocation.
///

--
2.52.0