]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
gpu: nova-core: introduce `bounded_enum` macro
authorAlexandre Courbot <acourbot@nvidia.com>
Wed, 25 Mar 2026 02:46:14 +0000 (11:46 +0900)
committerAlexandre Courbot <acourbot@nvidia.com>
Thu, 26 Mar 2026 06:08:27 +0000 (15:08 +0900)
commitb525d0c5e9ec4e51b54b8853047303957e8afbc4
tree8333300b5eec5706424424cc6f1d38d9ac00db76
parent442ba16a5a51368f5bafd011609f40782aec6d65
gpu: nova-core: introduce `bounded_enum` macro

Introduce a powered-up version of our ad-hoc `impl_from_enum_to_u8`
macro that allows the definition of an enum type associated to a
`Bounded` of a given width, and provides the `From` and `TryFrom`
implementations required to use that enum as a register field member.

This allows us to generate the required conversion implementations for
using the kernel register macro and skip some tedious boilerplate.

Acked-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patch.msgid.link/20260325-b4-nova-register-v4-1-bdf172f0f6ca@nvidia.com
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
drivers/gpu/nova-core/nova_core.rs
drivers/gpu/nova-core/num.rs