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

Re: [PATCH 00/17] Non-const bitfield helper conversions

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2021-11-23 08:20:53
Also in: alsa-devel, linux-aspeed, linux-clk, linux-gpio, linux-iio, linux-media, linux-mmc, linux-omap, linux-pm, linux-renesas-soc, lkml, netdev

Hi Alexandre,

On Mon, Nov 22, 2021 at 6:50 PM Alexandre Belloni
[off-list ref] wrote:
On 22/11/2021 16:53:53+0100, Geert Uytterhoeven wrote:
quoted
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.
To avoid this limitation, the AT91 clock driver already has its own
field_{prep,get}() macros.
My understanding was that this (being compile time only) was actually
done on purpose. Did I misunderstand?
Yes, it was done on purpose, to maximize type safety.

However, this imposes a severe limitation: we cannot use them in case
the mask is non-const (i.e. stored in some data structure).  This
is a quite common use-case, given the examples I found and converted,
and given you added field_{get,prep}() to the AT91 clock driver.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help