summaryrefslogtreecommitdiff
path: root/include/linux/stringify.h
diff options
context:
space:
mode:
authorGeert Uytterhoeven <[email protected]>2026-07-03 14:56:12 +0300
committerTom Rini <[email protected]>2026-07-08 13:29:18 -0600
commitda10fca9b062bde09144d65a0559676c658ac0ae (patch)
tree9a43f9b47ae15c0f75b623c079fc1bab92d44420 /include/linux/stringify.h
parent9c10cba536874641bbc70a53588d6a59c9292e2e (diff)
bitfield: Add non-constant field_{prep, get}() helpers
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 and several other drivers already have their own non-const field_{prep,get}() macros. Make them available for general use by adding them to <linux/bitfield.h>, and improve them slightly: 1. Avoid evaluating macro parameters more than once, 2. Replace "ffs() - 1" by "__ffs()", 3. Support 64-bit use on 32-bit architectures, 4. Wire field_{get,prep}() to FIELD_{GET,PREP}() when mask is actually constant. This is deliberately not merged into the existing FIELD_{GET,PREP}() macros, as people expressed the desire to keep stricter variants for increased safety, or for performance critical paths. Yury: use __mask within new macros. Signed-off-by: Geert Uytterhoeven <[email protected]> Acked-by: Alexandre Belloni <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Acked-by: Crt Mori <[email protected]> Acked-by: Nuno Sá <[email protected]> Acked-by: Richard Genoud <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Yury Norov (NVIDIA) <[email protected]> Signed-off-by: Yury Norov (NVIDIA) <[email protected]> [Linux commit: c1c6ab80b25c8db1e2ef5ae3ac8075d2c242ae13] Signed-off-by: Mikhail Kshevetskiy <[email protected]> Reviewed-by: David Lechner <[email protected]> Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'include/linux/stringify.h')
0 files changed, 0 insertions, 0 deletions