Re: [PATCH] rust/drm: tyr: Convert to the register!() macro
From: Danilo Krummrich
Date: Fri Jan 16 2026 - 08:58:14 EST
On Fri Jan 16, 2026 at 2:53 PM CET, Gary Guo wrote:
> On Fri Jan 16, 2026 at 1:38 PM GMT, Daniel Almeida wrote:
>>
>>>>>
>>>>> Is there any reason why you replace the UPPERCASE register names with
>>>>> CamelCase ones?
>>>>>
>>>>> I was under the impression that we want to use UPPERCASE for register
>>>>> names. Like in nova
>>>>>
>>>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/nova-core/regs.rs
>>>>
>>>> Not really. UPPERCASE for non-const items will trigger the linter. The Nova
>>>> people chose to #[allow] this to align with OpenRM and, IIRC from the LPC
>>>> discussions, their registers are automatically generated from some internal
>>>> docs.
>>>>
>>>> We have only a few, we can simply convert them to CamelCase.
>>>
>>> Frankly, register names do look nicer in UPPER_CASE, especially that they're in
>>> many cases, packed with acronyms.
>>>
>>> Best,
>>> Gary
>>>
>>
>> I don’t have an opinion here, to be honest. I think CamelCase does make it
>> easier on the eyes since our register names look quite simple,
I think you want to go with what your datasheets do, it is much easier for
people if names are consistent.
>
> You're on the lucky side! Most hardware don't enjoy that, especially if
> you want to match register names with the ones documented on the datasheet.
>
>> specially when
>> compared to Nova. However, I can switch to UPPER_CASE and add an
>> #![allow(non_camel_case_types)] if more people chime in.
>
> I wonder if we should just such allow `non_camel_case_types` to the register
> macro? I don't have an opinion on whether we want to enforce using UPPER_CASE,
> but at least I think we should allow it.
I fully agree here. I would not enforce it either, but given that the absolute
majority of datasheets uses UPPER_CASE for register names, we should allow it in
the register!() macro.