[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72kkgBtEWNQtu_tZpUYC+b-_3RsnWFO2biHPB74mrKE=AQ@mail.gmail.com>
Date: Thu, 27 Mar 2025 22:27:32 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Daniel Almeida <daniel.almeida@...labora.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>, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, Fiona Behrens <me@...enk.dev>
Subject: Re: [PATCH v5] rust: kernel: add support for bits/genmask macros
Hi Daniel,
My usual docs-only review... I hope that helps!
On Wed, Mar 26, 2025 at 3:07 PM Daniel Almeida
<daniel.almeida@...labora.com> wrote:
>
> +/// Equivalent to the kernel's `BIT` macro.
"To the C `BIT` macro" or "The C side ..." or similar -- these one
would be also the kernel's :)
> +/// Create a contiguous bitmask starting at bit position `l` and ending at
> +/// position `h`, where `h >= l`.
The first paragraph is a "short description" / title -- you may want
to leave the details to a second sentence, i.e. in a second paragraph.
Please check in any case how it looks in the rendered docs -- it may
be fine to have all in the title.
In fact, given you `assert!`, we should probably mention that very
prominently e.g. in a `# Panics` section. Or, better, avoid the panics
to begin with if it makes sense.
> +/// # Examples
> +/// ```
(Multiple instances) Newline between these.
> +/// use kernel::bits::genmask_u64;
(Multiple instances) You can hide this one with `#` -- when the `use`
is just for a single free function, I think it is not very useful to
show in the rendered docs, i.e. it is clear that you are showing that
one since the docs go with it.
> +/// let mask = genmask_u64(39, 21);
> +/// assert_eq!(mask, 0x000000ffffe00000);
(Multiple instances) The example is overindented, as if it was inside
a function.
> +///
> +pub const fn genmask_u32(h: u32, l: u32) -> u32 {
(Multiple instances) Extra `///` line.
Thanks!
Cheers,
Miguel
Powered by blists - more mailing lists