Re: [PATCH v2 2/8] rust: dma: add generalized container for types other than slices

Aditya Rajan
2026-03-21T23:22:18Z

On Fri Mar 20, 2026 at 12:45 PM PDT, Danilo Krummrich wrote:
> diff --git a/rust/kernel/dma.rs b/rust/kernel/dma.rs
> index 2eea7e2f8f04..ff3e147f1a23 100644
> --- a/rust/kernel/dma.rs
> +++ b/rust/kernel/dma.rs
> +impl<T> Coherent<[T]> {
> /// Returns the number of elements `T` in this allocation.
> ///
> /// Note that this is not the size of the allocation in bytes, which is provided by
> /// [`Self::size`].
> - pub fn count(&self) -> usize {
> - self.count
There is still a mention of `self.count` in the safety comments; perhaps that should be changed to `self.len()` ?
For example, see the safety comments in the following functions: `as_slice`, `as_slice_mut`, and `write` in same file.