Re: [PATCH v7] rust: kernel: add support for bits/genmask macros

From: Alice Ryhl
Date: Wed Jul 02 2025 - 06:27:52 EST


On Mon, Jun 23, 2025 at 10:18 PM Daniel Almeida
<daniel.almeida@xxxxxxxxxxxxx> wrote:
>
> In light of bindgen being unable to generate bindings for macros, and
> owing to the widespread use of these macros in drivers, manually define
> the bit and genmask C macros in Rust.
>
> The *_checked version of the functions provide runtime checking while
> the const version performs compile-time assertions on the arguments via
> the build_assert!() macro.
>
> Signed-off-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>

Is it intentional that the macros are not available for usize?

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>