Re: [PATCH v2 2/8] rust: dma: add generalized container for types other than slices
From: Gary Guo
Date: Sat Mar 21 2026 - 20:47:48 EST
On Sat Mar 21, 2026 at 11:22 PM GMT, Aditya Rajan wrote:
> 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.
They're going to be removed later, see https://lore.kernel.org/rust-for-linux/DH87CCNRR5EC.2SK3IT6N6Q8V5@xxxxxxxxxx/T/#m30142b65bb87af64860838565c784c304e02b563
Best,
Gary