Subject: Re: linux-next: build failure after merge of the bitmap tree

From: Geert Uytterhoeven <[email-masked]>
Date: Tue, 25 Nov 2025 09:05:48 +0100

Hi Stephen,

On Tue, 25 Nov 2025 at 08:24, Stephen Rothwell <[email-masked]> wrote:
> After merging the bitmap tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
>
> drivers/mtd/nand/raw/sunxi_nand.c:33:9: error: "field_get" redefined [-Werror]
>    33 | #define field_get(_mask, _reg) (((_reg) & (_mask)) >> (ffs(_mask) - 1))
>       |         ^~~~~~~~~
> In file included from include/linux/fortify-string.h:5,
>                  from include/linux/string.h:386,
>                  from include/linux/bitmap.h:13,
>                  from include/linux/cpumask.h:11,
>                  from arch/x86/include/asm/paravirt.h:21,
>                  from arch/x86/include/asm/cpuid/api.h:57,
>                  from arch/x86/include/asm/processor.h:19,
>                  from include/linux/sched.h:13,
>                  from include/linux/ratelimit.h:6,
>                  from include/linux/dev_printk.h:16,
>                  from include/linux/device.h:15,
>                  from include/linux/dma-mapping.h:5,
>                  from drivers/mtd/nand/raw/sunxi_nand.c:16:
> include/linux/bitfield.h:298:9: note: this is the location of the previous definition
>   298 | #define field_get(mask, reg)                                            \
>       |         ^~~~~~~~~
> drivers/mtd/nand/raw/sunxi_nand.c:34:9: error: "field_prep" redefined [-Werror]
>    34 | #define field_prep(_mask, _val) (((_val) << (ffs(_mask) - 1)) & (_mask))
>       |         ^~~~~~~~~~
> include/linux/bitfield.h:278:9: note: this is the location of the previous definition
>   278 | #define field_prep(mask, val)                                           \
>       |         ^~~~~~~~~~
> cc1: all warnings being treated as errors
>
> Caused by commit
>
>   c1c6ab80b25c ("bitfield: Add non-constant field_{prep,get}() helpers")
>
> interacting with commits
>
>   d21b4338159f ("mtd: rawnand: sunxi: introduce ecc_mode_mask in sunxi_nfc_caps")
>   6fc2619af1eb ("mtd: rawnand: sunxi: rework pattern found registers")
>
> from the nand tree.
>
> I have applied the following hack for today.
>
> From: Stephen Rothwell <[email-masked]>
> Date: Tue, 25 Nov 2025 17:47:46 +1100
> Subject: [PATCH] fix up for "bitfield: Add non-constant field_{prep,get}()
>  helpers"
>
> interacting with commits
>
>   d21b4338159f ("mtd: rawnand: sunxi: introduce ecc_mode_mask in sunxi_nfc_caps")
>   6fc2619af1eb ("mtd: rawnand: sunxi: rework pattern found registers")
>
> from the nand tree.
>
> Signed-off-by: Stephen Rothwell <[email-masked]>
> ---
>  drivers/mtd/nand/raw/sunxi_nand.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
> index 031ab651c5a8..b940eb5cf79a 100644
> --- a/drivers/mtd/nand/raw/sunxi_nand.c
> +++ b/drivers/mtd/nand/raw/sunxi_nand.c
> @@ -30,8 +30,8 @@
>  #include <linux/reset.h>
>
>  /* non compile-time field get/prep */
> -#define field_get(_mask, _reg) (((_reg) & (_mask)) >> (ffs(_mask) - 1))
> -#define field_prep(_mask, _val) (((_val) << (ffs(_mask) - 1)) & (_mask))
> +#define sunxi_field_get(_mask, _reg) (((_reg) & (_mask)) >> (ffs(_mask) - 1))
> +#define sunxi_field_prep(_mask, _val) (((_val) << (ffs(_mask) - 1)) & (_mask))

See "[PATCH -next v6 11/26] mtd: rawnand: sunxi: #undef
field_{get,prep}() before local definition"[1] and follow-up
"[PATCH -next v6 24/26] mtd: rawnand: sunxi: Convert to common
field_{get,prep}() helpers"[2].
The former unfortunately didn't make it into the nand tree yet...

[1] https://lore.kernel.org/all/703d7[email-masked]
[2] https://lore.kernel.org/all/e1c87[email-masked]/

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email-masked]

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