[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250204073011.5f6ca125@kernel.org>
Date: Tue, 4 Feb 2025 07:30:11 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Cc: Geert Uytterhoeven <geert+renesas@...der.be>, linux-clk@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-renesas-soc@...r.kernel.org,
linux-crypto@...r.kernel.org, qat-linux@...el.com,
linux-gpio@...r.kernel.org, linux-aspeed@...ts.ozlabs.org,
linux-iio@...r.kernel.org, linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org, Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, Nicolas Ferre
<nicolas.ferre@...rochip.com>, Alexandre Belloni
<alexandre.belloni@...tlin.com>, Claudiu Beznea <claudiu.beznea@...on.dev>,
Giovanni Cabiddu <giovanni.cabiddu@...el.com>, Herbert Xu
<herbert@...dor.apana.org.au>, "David S . Miller" <davem@...emloft.net>,
Linus Walleij <linus.walleij@...aro.org>, Bartosz Golaszewski
<brgl@...ev.pl>, Joel Stanley <joel@....id.au>, Andrew Jeffery
<andrew@...econstruct.com.au>, Crt Mori <cmo@...exis.com>, Jonathan Cameron
<jic23@...nel.org>, Lars-Peter Clausen <lars@...afoo.de>, Jacky Huang
<ychuang3@...oton.com>, Shan-Chun Hung <schung@...oton.com>, Yury Norov
<yury.norov@...il.com>, Rasmus Villemoes <linux@...musvillemoes.dk>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>, Johannes
Berg <johannes@...solutions.net>, Alex Elder <elder@...e.org>
Subject: Re: [PATCH treewide v2 1/3] bitfield: Add non-constant
field_{prep,get}() helpers
On Sun, 2 Feb 2025 17:26:04 +0900 Vincent Mailhol wrote:
> On 31/01/2025 at 22:46, Geert Uytterhoeven wrote:
> > The existing FIELD_{GET,PREP}() macros are limited to compile-time
> > constants. However, it is very common to prepare or extract bitfield
> > elements where the bitfield mask is not a compile-time constant.
>
> Why is it that the existing FIELD_{GET,PREP}() macros must be limited to
> compile time constants?
Hard no, some high performance networking drivers use this on
the fastpath. We want to make sure that the compiler doesn't
do anything stupid, and decomposes the masks at build time.
The macros work just fine for a *lot* of code:
$ git grep -E 'FIELD_(PREP|GET)\(' | wc -l
22407
BTW aren't u32_get_bits(), u32_replace_bits() etc. not what
you need in the first place? I think people don't know about
those, with all due respect the way they are coded up looks
like an IOCCC submission..
Powered by blists - more mailing lists