From: Danilo Krummrich <dakr@kernel.org>
To: "Benoît du Garreau" <benoit@dugarreau.fr>
Cc: gregkh@linuxfoundation.org, rafael@kernel.org, ojeda@kernel.org,
alex.gaynor@gmail.com, boqun.feng@gmail.com, gary@garyguo.net,
bjorn3_gh@protonmail.com, benno.lossin@proton.me,
a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu,
airlied@gmail.com, acourbot@nvidia.com, jhubbard@nvidia.com,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v2 3/4] rust: auxiliary: add auxiliary registration
Date: Mon, 17 Mar 2025 21:55:44 +0100 [thread overview]
Message-ID: <Z9iMUHRtzuqcbSm2@cassiopeiae> (raw)
In-Reply-To: <20250317204310.7804-1-benoit@dugarreau.fr>
On Mon, Mar 17, 2025 at 09:42:51PM +0100, Benoît du Garreau wrote:
> On Thu, 13 Mar 2025 03:23:52 +0100 Danilo Krummrich <dakr@kernel.org> wrote:
>
> > +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.
You're right, that works indeed, the full call looks like this.
let boxed = KBox::init(kernel::init::zeroed::<Opaque::<bindings::auxiliary_device>>(), GFP_KERNEL)?;
However, I think Opaque::zeroed() reads a bit better. Unless anything speaks
against adding it, I think I prefer it as it is.
next prev parent reply other threads:[~2025-03-17 20:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 2:23 [PATCH v2 0/4] Auxiliary bus Rust abstractions Danilo Krummrich
2025-03-13 2:23 ` [PATCH v2 1/4] rust: types: add `Opaque::zeroed` Danilo Krummrich
2025-03-13 2:23 ` [PATCH v2 2/4] rust: auxiliary: add auxiliary device / driver abstractions Danilo Krummrich
2025-03-13 2:23 ` [PATCH v2 3/4] rust: auxiliary: add auxiliary registration Danilo Krummrich
2025-03-17 20:42 ` Benoît du Garreau
2025-03-17 20:55 ` Danilo Krummrich [this message]
2025-03-18 18:36 ` Benno Lossin
2025-03-13 2:23 ` [PATCH v2 4/4] samples: rust: add Rust auxiliary driver sample Danilo Krummrich
2025-03-17 7:05 ` [PATCH v2 0/4] Auxiliary bus Rust abstractions Greg KH
2025-03-17 11:33 ` Danilo Krummrich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z9iMUHRtzuqcbSm2@cassiopeiae \
--to=dakr@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=benoit@dugarreau.fr \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.