Re: [PATCH] rust: prelude: add bit function

From: Boqun Feng
Date: Tue Jan 30 2024 - 15:07:04 EST


On Tue, Jan 30, 2024 at 05:04:15PM -0300, Wedson Almeida Filho wrote:
> On Tue, 30 Jan 2024 at 16:48, Christina Quast
> <contact@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > In order to create masks easily, the define BIT() is used in C code.
> > This commit adds the same functionality to the rust kernel.
>
> The `rust` branch has a generic `bit` function that allows the
> returned bit to be used with or converted to several numeric types.
>
> https://github.com/Rust-for-Linux/linux/blob/rust/rust/kernel/types.rs#L344

Plus, I think it's better to put the implementation at somewhere like:

kernel::type::bitops

Of course, it's OK to prelude it, but we shouldn't put implementation in
prelude.rs

Regards,
Boqun