Re: [PATCH v4 1/6] nova-core: bitfield: Move bitfield-specific code from register! into new macro

From: Danilo Krummrich

Date: Mon Sep 29 2025 - 16:26:04 EST


On Mon Sep 29, 2025 at 9:26 PM CEST, Joel Fernandes wrote:
> On 9/24/2025 12:40 PM, Greg KH wrote:
>> On Tue, Sep 23, 2025 at 06:24:34PM -0400, Joel Fernandes wrote:
> [..]
>>
>>> For the separate issue of enforcing endianness with respect to (across)
>>> multiple fields, I agree with you that if the user's backend (the consumer of
>>> the data) is not doing such conversion, say via regmap, then that becomes a
>>> problem. But that problem is orthogonal/different and cannot be solved here.
>>
>> But that is exactly what these macros are being defined here for, so to
>> ignore that is going to cause problems :)
>>
>
> If needed, happy to add endianness support as needed by providing additional
> options to the macro. Based on this thread, it sounds like we want see if that
> is really needed here or can be solved elsewhere (?). The mental model I kind of
> have is this macro should only be dealing with CPU native endianness, much like
> bitfields in C deal with CPU endianness. Hmm.

At least for register!() we don't need anything else than CPU endianness. In
fact, as described in [1], any representation is fine as long as it is
consistent.

[1] https://lore.kernel.org/all/DD0ZTZM8S84H.1YDWSY7DF14LM@xxxxxxxxxx/