summaryrefslogtreecommitdiff
path: root/rust/helpers/xarray.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2025-11-06 14:34:01 +0100
committerYury Norov (NVIDIA) <yury.norov@gmail.com>2025-11-24 14:15:46 -0500
commitc1c6ab80b25c8db1e2ef5ae3ac8075d2c242ae13 (patch)
tree8c2d2d171c49ad0f1dbe7be25a92685c157a675b /rust/helpers/xarray.c
parent2a6c045640c38a407a39cd40c3c4d8dd2fd89aa8 (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 withing new macros. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Crt Mori <cmo@melexis.com> Acked-by: Nuno Sá <nuno.sa@analog.com> Acked-by: Richard Genoud <richard.genoud@bootlin.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Yury Norov (NVIDIA) <yury.norov@gmail.com> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
Diffstat (limited to 'rust/helpers/xarray.c')
0 files changed, 0 insertions, 0 deletions