[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <79427200-D82D-4EC8-BE6A-A1964DACEB5C@collabora.com>
Date: Tue, 10 Jun 2025 17:52:34 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>,
Alexandre Courbot <acourbot@...dia.com>,
linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v6] rust: kernel: add support for bits/genmask macros
Hi Miguel,
> On 10 Jun 2025, at 15:08, Miguel Ojeda <miguel.ojeda.sandonis@...il.com> wrote:
>
> On Tue, Jun 10, 2025 at 4:16 PM Daniel Almeida
> <daniel.almeida@...labora.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
Powered by blists - more mailing lists