Re: [PATCH v4 2/6] nova-core: bitfield: Add support for different storage widths

From: Joel Fernandes

Date: Mon Sep 29 2025 - 15:47:42 EST




On 9/29/2025 8:22 AM, Alexandre Courbot wrote:
> On Sun Sep 21, 2025 at 3:22 AM JST, Joel Fernandes wrote:
>> Previously, bitfields were hardcoded to use u32 as the underlying
>> storage type. Add support for different storage types (u8, u16, u32,
>> u64) to the bitfield macro.
>>
>> New syntax is: struct Name: <type ex., u32> { ... }
>>
>> Reviewed-by: Elle Rhumsaa <elle@xxxxxxxxxxxxxxxxxxx>
>> Signed-off-by: Joel Fernandes <joelagnelf@xxxxxxxxxx>
>> ---
>> drivers/gpu/nova-core/bitfield.rs | 71 +++++++++++++++++-----------
>> drivers/gpu/nova-core/regs/macros.rs | 16 +++----
>> 2 files changed, 52 insertions(+), 35 deletions(-)
>>
>> diff --git a/drivers/gpu/nova-core/bitfield.rs b/drivers/gpu/nova-core/bitfield.rs
>> index ba6b7caa05d9..687ef234be75 100644
>> --- a/drivers/gpu/nova-core/bitfield.rs
>> +++ b/drivers/gpu/nova-core/bitfield.rs
>> @@ -51,7 +51,7 @@
>> //! }
>> //!
>> //! bitfield! {
>> -//! struct ControlReg {
>> +//! struct ControlReg: u32 {
>
> Haven't we agreed in [1] to align the type definition syntax to that of
> an actual Rust struct? E.g. `struct ControlReg(u32)`?
>
> [1] https://lore.kernel.org/all/3814d6b7-7551-4e8c-b78a-4ac6236eb406@xxxxxxxxxx/

Sorry this slipped (conference travel and all :P). I will make the change this
time. Btw v5 also has other changes in addition to this, your review is much
appreciated :)

- Joel