mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Almeida <daniel.almeida@collabora.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v6] rust: kernel: add support for bits/genmask macros
Date: Tue, 10 Jun 2025 17:52:34 -0300	[thread overview]
Message-ID: <79427200-D82D-4EC8-BE6A-A1964DACEB5C@collabora.com> (raw)
In-Reply-To: <CANiq72nHzEN9D2yEkXNAWGySQADtUCW_V0YtpnCvHG=nxdeDCQ@mail.gmail.com>

Hi Miguel,

> On 10 Jun 2025, at 15:08, Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote:
> 
> On Tue, Jun 10, 2025 at 4:16 PM Daniel Almeida
> <daniel.almeida@collabora.com> wrote:
>> 
>> +use crate::build_assert;
> 
> You can include the prelude instead.
> 
>> +            (1 as $ty) .checked_shl(n)
> 
> Formatting.
> 
>> +        pub fn $unbounded_name(n: u32) -> $ty {
> 
> We may want to have a comment inside here to remind ourselves to
> forward the call to the standard library one when available (1.87.0).
> 
>> +        /// Creates a compile-time contiguous bitmask for the given range by
>> +        /// validating the range at runtime.
> 
> I may be confused by what you are trying to do here, but how are these
> `checked` and `unbounded` ones compile-time?

This is wrong indeed, thanks for catching that.

> 
> Also, you can probably simplify the macro `impl` calls by removing
> parameters by using `paste!`, e.g.
> 
>    let high = ::kernel::macros::paste!([<checked_bit_ $ty>])(range.end)?;

I personally find paste’s syntax a bit hard to read, but sure, I have nothing against this.

> 
>> base-commit: cf25bc61f8aecad9b0c45fe32697e35ea4b13378
> 
> This is a fairly old base now (the patch does not apply cleanly).

Sorry about that. 

Anyways, let's see if others are happy with the direction this patch is now
taking. I will rebase on the next iteration :)

> 
> Thanks!
> 
> Cheers,
> Miguel
> 

— Daniel

  reply	other threads:[~2025-06-10 20:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10 14:14 Daniel Almeida
2025-06-10 18:08 ` Miguel Ojeda
2025-06-10 20:52   ` Daniel Almeida [this message]
2025-06-14 13:38 ` Alexandre Courbot
2025-06-14 15:06   ` Boqun Feng
2025-06-14 15:56     ` Boqun Feng
2025-06-14 16:05       ` Boqun Feng
2025-06-18 20:58         ` Joel Fernandes
2025-06-20 13:48           ` Daniel Almeida
2025-06-20 20:47             ` Joel Fernandes
2025-06-15 12:59     ` Alexandre Courbot
2025-06-16 14:14   ` Daniel Almeida
2025-06-16 14:29     ` Boqun Feng
2025-06-16 14:42       ` Daniel Almeida
2025-06-16 14:45         ` Daniel Almeida
2025-06-16 14:52           ` Alexandre Courbot
2025-06-16 14:56             ` Daniel Almeida
2025-06-16 15:02               ` Alexandre Courbot
2025-06-16 15:02           ` Boqun Feng
2025-06-16 15:08     ` Alexandre Courbot

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=79427200-D82D-4EC8-BE6A-A1964DACEB5C@collabora.com \
    --to=daniel.almeida@collabora.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --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

all inboxes | Powered by JetHome®