All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ritvik Gupta <ritvikfoss@gmail.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: tglx@kernel.org, peterz@infradead.org, ojeda@kernel.org,
	boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com,
	lossin@kernel.org, a.hindborg@kernel.org, aliceryhl@google.com,
	tmgross@umich.edu, dakr@kernel.org, linux-kernel@vger.kernel.org,
	rust-for-linux@vger.kernel.org, skhan@linuxfoundation.org
Subject: Re: [PATCH v2 2/2] rust: cpu: use `unsafe_precondition_assert!`
Date: Thu, 21 May 2026 22:32:54 +0530	[thread overview]
Message-ID: <ag86vsdILqttOkL4@fedora> (raw)
In-Reply-To: <CANiq72=mhWr4GqknqwSzSbo1w1whNZtKHeVL1Pc3d+3A1kJ1sg@mail.gmail.com>

On Tue, May 19, 2026 at 07:41:59AM +0200, Miguel Ojeda wrote:
> On Tue, May 19, 2026 at 12:57 AM Ritvik Gupta <ritvikfoss@gmail.com> wrote:
> >
> > Replace `debug_assert!` invocations with
> > `unsafe_precondition_assert!` in `from_i32_unchecked`
> > and `from_u32_unchecked` unsafe functions.
> 
> The commit message doesn't mention why the messages were added -- I
> asked for it because I am not sure if it is worth providing a message
> for each assertion, especially since the original code decided to
> avoid it, i.e. the change to the new macro is good on its own,
> regardless of the messages.
> 

Actually, I added messages from UX standpoint, as having explicit
failure reason is helpful for debugging, when an assertion is hit.

I can update the commit message to clarify this, or remove it if
maintainers prefer keeping it as is.

> > -use crate::{bindings, device::Device, error::Result, prelude::ENODEV};
> > +use crate::{bindings, device::Device, error::Result, prelude::*};
> 
> By the way, we could remove `error::Result` from the list since we
> have the entire prelude now, and also take the chance to use the new
> style:
> 
>   https://docs.kernel.org/rust/coding-guidelines.html#imports
> 

Sure, will remove `error::Result` and use vertical-import style.

> But maybe wait to see if the maintainers have other feedback before v3.
> 
> Thanks!
> 
> Cheers,
> Miguel

Yeah, will wait for some time.
Thanks for your feedback :)

      reply	other threads:[~2026-05-21 16:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18 23:01 [PATCH v2 0/2] rust: re-export `unsafe_precondition_assert!` and use in cpu module Ritvik Gupta
2026-05-18 23:01 ` [PATCH v2 1/2] rust: prelude: re-export `unsafe_precondition_assert!` Ritvik Gupta
2026-05-18 23:01 ` [PATCH v2 2/2] rust: cpu: use `unsafe_precondition_assert!` Ritvik Gupta
2026-05-19  5:41   ` Miguel Ojeda
2026-05-21 17:02     ` Ritvik Gupta [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=ag86vsdILqttOkL4@fedora \
    --to=ritvikfoss@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tglx@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.