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

Stephen Rothwell posted 1 patch 6 days, 16 hours ago
drivers/mtd/nand/raw/sunxi_nand.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
linux-next: build failure after merge of the bitmap tree
Posted by Stephen Rothwell 6 days, 16 hours ago
Hi all,

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 <sfr@canb.auug.org.au>
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 <sfr@canb.auug.org.au>
---
 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))
 
 #define NFC_REG_CTL		0x0000
 #define NFC_REG_ST		0x0004
@@ -185,7 +185,7 @@
 #define NFC_RANDOM_EN(nfc)	(nfc->caps->random_en_mask)
 #define NFC_RANDOM_DIRECTION(nfc) (nfc->caps->random_dir_mask)
 #define NFC_ECC_MODE_MSK(nfc)	(nfc->caps->ecc_mode_mask)
-#define NFC_ECC_MODE(nfc, x)	field_prep(NFC_ECC_MODE_MSK(nfc), (x))
+#define NFC_ECC_MODE(nfc, x)	sunxi_field_prep(NFC_ECC_MODE_MSK(nfc), (x))
 /* RANDOM_PAGE_SIZE: 0: ECC block size  1: page size */
 #define NFC_A23_RANDOM_PAGE_SIZE	BIT(11)
 #define NFC_H6_RANDOM_PAGE_SIZE	BIT(7)
@@ -879,7 +879,7 @@ static void sunxi_nfc_set_user_data_len(struct sunxi_nfc *nfc,
 	val = readl(nfc->regs + NFC_REG_USER_DATA_LEN(nfc, step));
 
 	val &= ~NFC_USER_DATA_LEN_MSK(step);
-	val |= field_prep(NFC_USER_DATA_LEN_MSK(step), i);
+	val |= sunxi_field_prep(NFC_USER_DATA_LEN_MSK(step), i);
 	writel(val, nfc->regs + NFC_REG_USER_DATA_LEN(nfc, step));
 }
 
@@ -992,7 +992,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct nand_chip *nand,
 	*cur_off = oob_off + ecc->bytes + USER_DATA_SZ;
 
 	pattern_found = readl(nfc->regs + nfc->caps->reg_pat_found);
-	pattern_found = field_get(NFC_ECC_PAT_FOUND_MSK(nfc), pattern_found);
+	pattern_found = sunxi_field_get(NFC_ECC_PAT_FOUND_MSK(nfc), pattern_found);
 
 	ret = sunxi_nfc_hw_ecc_correct(nand, data, oob_required ? oob : NULL, 0,
 				       readl(nfc->regs + NFC_REG_ECC_ST),
@@ -1121,7 +1121,7 @@ static int sunxi_nfc_hw_ecc_read_chunks_dma(struct nand_chip *nand, uint8_t *buf
 
 	status = readl(nfc->regs + NFC_REG_ECC_ST);
 	pattern_found = readl(nfc->regs + nfc->caps->reg_pat_found);
-	pattern_found = field_get(NFC_ECC_PAT_FOUND_MSK(nfc), pattern_found);
+	pattern_found = sunxi_field_get(NFC_ECC_PAT_FOUND_MSK(nfc), pattern_found);
 
 	for (i = 0; i < nchunks; i++) {
 		int data_off = i * ecc->size;
-- 
2.52.0

-- 
Cheers,
Stephen Rothwell
Re: linux-next: build failure after merge of the bitmap tree
Posted by Geert Uytterhoeven 6 days, 15 hours ago
Hi Stephen,

On Tue, 25 Nov 2025 at 08:24, Stephen Rothwell <sfr@canb.auug.org.au> 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 <sfr@canb.auug.org.au>
> 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 <sfr@canb.auug.org.au>
> ---
>  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/703d7eec56074148daed4ea45b637f8a83f15305.1762435376.git.geert+renesas@glider.be
[2] https://lore.kernel.org/all/e1c879967328d8c1098aaa014845c2f11874d7c7.1762435376.git.geert+renesas@glider.be/

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
Re: linux-next: build failure after merge of the bitmap tree
Posted by Miquel Raynal 3 days, 15 hours ago
Hello,

>> 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 <sfr@canb.auug.org.au>
>> 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 <sfr@canb.auug.org.au>
>> ---
>>  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/703d7eec56074148daed4ea45b637f8a83f15305.1762435376.git.geert+renesas@glider.be

I've had some issues since a distribution update, but I've taken the patch
locally and prepared my branch for the merge window, I cannot push to
the MTD repository right now but it will be done tonight.

Thanks,
Miquèl
Re: linux-next: build failure after merge of the bitmap tree
Posted by Miquel Raynal 6 days, 15 hours ago
Hello Geert,

>>  /* 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/703d7eec56074148daed4ea45b637f8a83f15305.1762435376.git.geert+renesas@glider.be
> [2] https://lore.kernel.org/all/e1c879967328d8c1098aaa014845c2f11874d7c7.1762435376.git.geert+renesas@glider.be/

It wasn't clear to me when/if I could effectively pull these, nor if
they would make it for this release. Were you (or someone else) supposed
to carry these on your own? Or, can I just apply these two now?

Thanks,
Miquèl
Re: linux-next: build failure after merge of the bitmap tree
Posted by Miquel Raynal 6 days, 14 hours ago
>On 25/11/2025 at 09:31:48 +01, Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Hello Geert,
>
>>>  /* 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/703d7eec56074148daed4ea45b637f8a83f15305.1762435376.git.geert+renesas@glider.be
>> [2] https://lore.kernel.org/all/e1c879967328d8c1098aaa014845c2f11874d7c7.1762435376.git.geert+renesas@glider.be/
>
> It wasn't clear to me when/if I could effectively pull these, nor if
> they would make it for this release. Were you (or someone else) supposed
> to carry these on your own? Or, can I just apply these two now?

Actually it's entirely my fault, I put that series aside given the
bikeshedding that happened on patch 12. I am sorry for not being more
pushy on my side, this is great job I should have encouraged with more
engagement, but I tend to loose all kind of motivation when it comes to
arguing with perfectionists.

So as hinted in the cover letter, I'll take patch 11 now and apply the
other patch (which I blindly acked already) on top of -rc1. Don't
hesitate to ping me or resend if I don't.

Thanks,
Miquèl
Re: linux-next: build failure after merge of the bitmap tree
Posted by Geert Uytterhoeven 6 days, 14 hours ago
Hi Miquel,

On Tue, 25 Nov 2025 at 09:31, Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >>  /* 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/703d7eec56074148daed4ea45b637f8a83f15305.1762435376.git.geert+renesas@glider.be
> > [2] https://lore.kernel.org/all/e1c879967328d8c1098aaa014845c2f11874d7c7.1762435376.git.geert+renesas@glider.be/
>
> It wasn't clear to me when/if I could effectively pull these, nor if
> they would make it for this release. Were you (or someone else) supposed
> to carry these on your own? Or, can I just apply these two now?

The first one you can apply now, to fix the build issue.
The second one has to wait until the changes to <linux/bitfield.h>
are in your tree.

Thanks!

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
Re: linux-next: build failure after merge of the bitmap tree
Posted by Yury Norov 6 days, 8 hours ago
On Tue, Nov 25, 2025 at 09:37:25AM +0100, Geert Uytterhoeven wrote:
> Hi Miquel,
> 
> On Tue, 25 Nov 2025 at 09:31, Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> > >>  /* 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/703d7eec56074148daed4ea45b637f8a83f15305.1762435376.git.geert+renesas@glider.be
> > > [2] https://lore.kernel.org/all/e1c879967328d8c1098aaa014845c2f11874d7c7.1762435376.git.geert+renesas@glider.be/
> >
> > It wasn't clear to me when/if I could effectively pull these, nor if
> > they would make it for this release. Were you (or someone else) supposed
> > to carry these on your own? Or, can I just apply these two now?
> 
> The first one you can apply now, to fix the build issue.
> The second one has to wait until the changes to <linux/bitfield.h>
> are in your tree.

Is anything expected on my side? Should I drop the trouble patch, or
just wait, or something else?
Re: linux-next: build failure after merge of the bitmap tree
Posted by Miquel Raynal 6 days, 8 hours ago
Hello Yury,

On 25/11/2025 at 09:44:27 -05, Yury Norov <yury.norov@gmail.com> wrote:

> On Tue, Nov 25, 2025 at 09:37:25AM +0100, Geert Uytterhoeven wrote:
>> Hi Miquel,
>> 
>> On Tue, 25 Nov 2025 at 09:31, Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>> > >>  /* 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/703d7eec56074148daed4ea45b637f8a83f15305.1762435376.git.geert+renesas@glider.be
>> > > [2] https://lore.kernel.org/all/e1c879967328d8c1098aaa014845c2f11874d7c7.1762435376.git.geert+renesas@glider.be/
>> >
>> > It wasn't clear to me when/if I could effectively pull these, nor if
>> > they would make it for this release. Were you (or someone else) supposed
>> > to carry these on your own? Or, can I just apply these two now?
>> 
>> The first one you can apply now, to fix the build issue.
>> The second one has to wait until the changes to <linux/bitfield.h>
>> are in your tree.
>
> Is anything expected on my side? Should I drop the trouble patch, or
> just wait, or something else?

Don't drop it, it's on my side to apply the "undef" fix now.

Thanks,
Miquèl