rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Alexandre Courbot" <acourbot@nvidia.com>,
	"Atharv Dubey" <atharvd440@gmail.com>,
	<gregkh@linuxfoundation.org>, <ojeda@kernel.org>,
	<alex.gaynor@gmail.com>
Cc: <david.m.ertman@intel.com>, <ira.weiny@intel.com>,
	<leon@kernel.org>, <boqun.feng@gmail.com>, <gary@garyguo.net>,
	<bjorn3_gh@protonmail.com>, <lossin@kernel.org>,
	<a.hindborg@kernel.org>, <aliceryhl@google.com>,
	<tmgross@umich.edu>, <dakr@kernel.org>,
	<rust-for-linux@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] rust: auxiliary: use `pin_init::zeroed()` for  device ID
Date: Mon, 01 Dec 2025 12:44:38 +0900	[thread overview]
Message-ID: <DEMKK0Z8DWR1.3EBQYP6YO32JA@nvidia.com> (raw)
In-Reply-To: <DEMKCLMSAUUX.1Y5ZKG3T3PC1K@nvidia.com>

On Mon Dec 1, 2025 at 12:34 PM JST, Alexandre Courbot wrote:
> On Sat Nov 29, 2025 at 9:47 PM JST, Atharv Dubey wrote:
>> Replace the previous `unsafe { core::mem::zeroed() }` initialization
>> for `bindings::auxillary_device_id` with `pin_init::zeroed()`. This removes
>> the explicit unsafe block and uses the safer pinned zero-initialization
>> helper.
>>
>> Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
>> ---
>>  rust/kernel/auxiliary.rs | 6 +-----
>>  1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/rust/kernel/auxiliary.rs b/rust/kernel/auxiliary.rs
>> index 7a3b0b9c418e..67c5d356d754 100644
>> --- a/rust/kernel/auxiliary.rs
>> +++ b/rust/kernel/auxiliary.rs
>> @@ -108,11 +108,7 @@ pub const fn new(modname: &'static CStr, name: &'static CStr) -> Self {
>>          let name = name.to_bytes_with_nul();
>>          let modname = modname.to_bytes_with_nul();
>>  
>> -        // TODO: Replace with `bindings::auxiliary_device_id::default()` once stabilized for
>> -        // `const`.
>
> I'd still keep this `TODO`, a `Default` implementation is more adequate
> that `Zeroable` here even if they end up doing the same.

... or maybe not, after all if a type implements `Zeroable` this means
that all zeroes is a valid initial value for it. Let's see what others
think about this.

      reply	other threads:[~2025-12-01  3:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-29 12:47 [PATCH] rust: auxiliary: use `pin_init::zeroed()` for device ID Atharv Dubey
2025-12-01  3:34 ` Alexandre Courbot
2025-12-01  3:44   ` Alexandre Courbot [this message]

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=DEMKK0Z8DWR1.3EBQYP6YO32JA@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=atharvd440@gmail.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=david.m.ertman@intel.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=ira.weiny@intel.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).