diff options
| author | Alexandre Courbot <acourbot@nvidia.com> | 2026-06-06 21:43:04 +0900 |
|---|---|---|
| committer | Miguel Ojeda <ojeda@kernel.org> | 2026-06-09 04:12:51 +0200 |
| commit | b7b8b4ccdad45a59aafa5cfc32a51fe1ee5cb680 (patch) | |
| tree | c9b5b2febb146c97e81be72dca9a6d1e89efc2c0 /rust/kernel/lib.rs | |
| parent | 09699b24199ac546037de252ba4907d99f4a8c7a (diff) | |
rust: extract `bitfield!` macro from `register!`
Extract the bitfield-defining part of the `register!` macro into an
independent macro used to define bitfield types with bounds-checked
accessors.
Each field is represented as a `Bounded` of the appropriate bit width,
ensuring field values are never silently truncated.
Fields can optionally be converted to/from custom types, either fallibly
or infallibly.
Appropriate documentation is also added, and a MAINTAINERS entry created
for the new module.
Two minor fixups are also applied: the private accessors are inlined,
and a couple of missing fully qualified types in the macro are fixed.
Acked-by: Yury Norov <ynorov@nvidia.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Yury Norov <ynorov@nvidia.com>
Link: https://patch.msgid.link/20260606-bitfield-v5-1-b92188820914@nvidia.com
[ Added some more intra-doc links. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel/lib.rs')
| -rw-r--r-- | rust/kernel/lib.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs index b72b2fbe046d..9512af7156df 100644 --- a/rust/kernel/lib.rs +++ b/rust/kernel/lib.rs @@ -44,6 +44,7 @@ pub mod acpi; pub mod alloc; #[cfg(CONFIG_AUXILIARY_BUS)] pub mod auxiliary; +pub mod bitfield; pub mod bitmap; pub mod bits; #[cfg(CONFIG_BLOCK)] |
