Re: [PATCH v2 3/4] rust: auxiliary: add auxiliary registration
From: Benno Lossin
Date: Tue Mar 18 2025 - 14:38:37 EST
On Mon Mar 17, 2025 at 9:42 PM CET, Benoît du Garreau wrote:
> On Thu, 13 Mar 2025 03:23:52 +0100 Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
>> Implement the `auxiliary::Registration` type, which provides an API to
>> +impl Registration {
>> + /// Create and register a new auxiliary device.
>> + pub fn new(parent: &device::Device, name: &CStr, id: u32, modname: &CStr) -> Result<Self> {
>> + let boxed = KBox::new(Opaque::<bindings::auxiliary_device>::zeroed(), GFP_KERNEL)?;
>
> You can use `KBox::init(kernel::init::zeroed(), GFP_KERNEL)` here. It avoids
> the need for the first patch.
We probably should have the zeroed function on the `Zeroable` trait...
---
Cheers,
Benno