Re: [PATCH v2 5/8] rust: dma: add Coherent:init() and Coherent::init_with_attrs()

Andreas Hindborg
2026-03-24T15:40:32Z

"Danilo Krummrich" <dakr@kernel.org> writes:

> On Tue Mar 24, 2026 at 3:00 PM CET, Andreas Hindborg wrote:
>>> + /// Same as [`Coherent::zeroed`], but instead of a zero-initialization the memory is initialized
>>> + /// with `init`.
>>> + #[inline]
>>> + pub fn init<E>(
>>> + dev: &device::Device<Bound>,
>>> + gfp_flags: kernel::alloc::Flags,
>>> + init: impl Init<T, E>,
>>> + ) -> Result<Self>
>>> + where
>>> + Error: From<E>,
>>> + {
>>> + Self::init_with_attrs(dev, gfp_flags, Attrs(0), init)
>>> + }
>>> +
>>
>> I think we are missing an array initializer for `Coherent<[T]>`.
>
> This method is already compatible with arrays, T can be an array type itself,
> e.g. T = [MyStruct; 5].
>
> For instance, the diff in [1] should work.

Cool!

>> Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
>
> Thanks! The patch series has been applied yesterday, and the branch it has been
> applied to is immutable, so I can't add additional tags.

You guys move fast!

> However, the Link: included in the patch still points to this conversation.
>
> Also note that subsequent review is still valued; we can always send follow-up
> patches if required.

At any rate I can send the changes I suggested if they are deemed valid.

Best regards,
Andreas Hindborg