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-23 16:24:55
Also in: alsa-devel, 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 09:36 +0100, Geert Uytterhoeven wrote:


Ah, here's your comment wrt. which one is nicer :)
quoted
quoted
We have the upper-case (constant) versions, and already
{u32,...}_get_bits()/etc.
TBH, I don't like the *_get_bits() API: in general, u32_get_bits() does
the same as FIELD_GET(), but the order of the parameters is different?
I don't really see how "the order of parameters is different" is a
downside? Yeah it means if you're used to FIELD_GET() then you'll
retrain, but ...?
(*_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
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?

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