Thread (40 messages) 40 messages, 11 authors, 2021-11-24

Re: [PATCH 01/17] bitfield: Add non-constant field_{prep,get}() helpers

From: Johannes Berg <johannes@sipsolutions.net>
Date: 2021-11-24 08:04:39
Also in: linux-aspeed, linux-clk, linux-gpio, linux-iio, linux-media, linux-mmc, linux-omap, linux-renesas-soc, linux-wireless, lkml, netdev

On Tue, 2021-11-23 at 15:49 -0800, Jakub Kicinski wrote:
On Tue, 23 Nov 2021 17:24:15 +0100 Johannes Berg wrote:
quoted
quoted
(*_replace_bits() seems to be useful, though)  
Indeed.

Also as I said in my other mail, the le32/be32/... variants are
tremendously useful, and they fundamentally cannot be expressed with the
FIELD_GET() or field_get() macros. IMHO this is a clear advantage to the
Can you elaborate?
Well, the way I see it, the only advantage of FIELD_GET() is that it
will auto-determine the type (based on the mask type.) This cannot work
if you need be/le conversions, because the be/le type annotations are
invisible to the compiler.

So obviously you could write a BE32_FIELD_GET(), but then really that's
equivalent to be32_get_bits() - note you you have to actually specify
the type in the macro name. I guess in theory you could make macros
where the type is an argument (like FIELD_GET_TYPE(be32, ...)), but I
don't see how that gains anything.
quoted
typed versions, and if you ask me we should get rid of the FIELD_GETand
FIELD_PREP entirely - difficult now, but at least let's not propagate
that?
I don't see why.
Just for being more regular, in the spirit of "there's exactly one
correct way of doing it" :)

johannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help