2023-02-10 03:34:32

by Randy Dunlap

[permalink] [raw]
Subject: mux/mmio: randconfig build errors

Hi,

The attached i386 config file causes these build errors:

../drivers/mux/mmio.c: In function ‘mux_mmio_probe’:
../drivers/mux/mmio.c:76:34: error: storage size of ‘field’ isn’t known
76 | struct reg_field field;
| ^~~~~
In file included from ../include/linux/bits.h:21,
from ../include/linux/bitops.h:6,
from ../drivers/mux/mmio.c:8:
../include/linux/bits.h:23:28: error: first argument to ‘__builtin_choose_expr’ not a constant
23 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
| ^~~~~~~~~~~~~~~~~~~~~
../include/linux/build_bug.h:16:62: note: in definition of macro ‘BUILD_BUG_ON_ZERO’
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
../include/linux/bits.h:37:10: note: in expansion of macro ‘GENMASK_INPUT_CHECK’
37 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
../drivers/mux/mmio.c:96:29: note: in expansion of macro ‘GENMASK’
96 | if (mask != GENMASK(field.msb, field.lsb)) {
| ^~~~~~~
../include/linux/build_bug.h:16:51: error: bit-field ‘<anonymous>’ width not an integer constant
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
../include/linux/bits.h:23:10: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
23 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
| ^~~~~~~~~~~~~~~~~
../include/linux/bits.h:37:10: note: in expansion of macro ‘GENMASK_INPUT_CHECK’
37 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
../drivers/mux/mmio.c:96:29: note: in expansion of macro ‘GENMASK’
96 | if (mask != GENMASK(field.msb, field.lsb)) {
| ^~~~~~~
../drivers/mux/mmio.c:102:29: error: implicit declaration of function ‘devm_regmap_field_alloc’ [-Werror=implicit-function-declaration]
102 | fields[i] = devm_regmap_field_alloc(dev, regmap, field);
| ^~~~~~~~~~~~~~~~~~~~~~~
../drivers/mux/mmio.c:76:34: warning: unused variable ‘field’ [-Wunused-variable]
76 | struct reg_field field;
| ^~~~~

Does anyone have any suggestions for how to resolve this problem
so that an erroneous randconfig file cannot be created?

Thanks.
--
~Randy


Attachments:
config-i386-mux-mmio-errs (60.69 kB)

2023-02-10 10:41:30

by Peter Rosin

[permalink] [raw]
Subject: Re: mux/mmio: randconfig build errors

Hi!

2023-02-10 at 04:34, Randy Dunlap wrote:
> ../drivers/mux/mmio.c: In function ‘mux_mmio_probe’:
> ../drivers/mux/mmio.c:76:34: error: storage size of ‘field’ isn’t known
> 76 | struct reg_field field;
> | ^~~~~

*snip*

> Does anyone have any suggestions for how to resolve this problem
> so that an erroneous randconfig file cannot be created?

Look like REGMAP is desperately needed. I'll follow up with a suggested
patch.

Cheers,
Peter

2023-02-10 10:46:54

by Peter Rosin

[permalink] [raw]
Subject: [PATCH] mux: mmio: select REGMAP as the code has that dependency

If CONFIG_REGMAP is not active, the build errors out like this:

../drivers/mux/mmio.c: In function ‘mux_mmio_probe’:
../drivers/mux/mmio.c:76:34: error: storage size of ‘field’ isn’t known
76 | struct reg_field field;
| ^~~~~
In file included from ../include/linux/bits.h:21,
from ../include/linux/bitops.h:6,
from ../drivers/mux/mmio.c:8:
../include/linux/bits.h:23:28: error: first argument to ‘__builtin_choose_expr’ not a constant
23 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
| ^~~~~~~~~~~~~~~~~~~~~
../include/linux/build_bug.h:16:62: note: in definition of macro ‘BUILD_BUG_ON_ZERO’
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
../include/linux/bits.h:37:10: note: in expansion of macro ‘GENMASK_INPUT_CHECK’
37 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
../drivers/mux/mmio.c:96:29: note: in expansion of macro ‘GENMASK’
96 | if (mask != GENMASK(field.msb, field.lsb)) {
| ^~~~~~~
../include/linux/build_bug.h:16:51: error: bit-field ‘<anonymous>’ width not an integer constant
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
../include/linux/bits.h:23:10: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
23 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
| ^~~~~~~~~~~~~~~~~
../include/linux/bits.h:37:10: note: in expansion of macro ‘GENMASK_INPUT_CHECK’
37 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
../drivers/mux/mmio.c:96:29: note: in expansion of macro ‘GENMASK’
96 | if (mask != GENMASK(field.msb, field.lsb)) {
| ^~~~~~~
../drivers/mux/mmio.c:102:29: error: implicit declaration of function ‘devm_regmap_field_alloc’ [-Werror=implicit-function-declaration]
102 | fields[i] = devm_regmap_field_alloc(dev, regmap, field);
| ^~~~~~~~~~~~~~~~~~~~~~~
../drivers/mux/mmio.c:76:34: warning: unused variable ‘field’ [-Wunused-variable]
76 | struct reg_field field;
| ^~~~~

Reported by: Randy Dunlap <[email protected]>
Link: https://lore.kernel.org/lkml/[email protected]/
Signed-off-by: Peter Rosin <[email protected]>
---
drivers/mux/Kconfig | 1 +
1 file changed, 1 insertion(+)

Note, there is a patch in linux-next that removes "|| COMPILE_TEST" from depends.

Cheers,
Peter

diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig
index 80f015cf6e54..9234f8c400ca 100644
--- a/drivers/mux/Kconfig
+++ b/drivers/mux/Kconfig
@@ -48,6 +48,7 @@ config MUX_GPIO
config MUX_MMIO
tristate "MMIO/Regmap register bitfield-controlled Multiplexer"
depends on OF
+ select REGMAP
help
MMIO/Regmap register bitfield-controlled Multiplexer controller.

--
2.20.1


2023-02-10 11:56:34

by Philipp Zabel

[permalink] [raw]
Subject: Re: [PATCH] mux: mmio: select REGMAP as the code has that dependency

On Fri, Feb 10, 2023 at 11:46:42AM +0100, Peter Rosin wrote:
> If CONFIG_REGMAP is not active, the build errors out like this:

The driver used to have an indirect dependency on CONFIG_REGMAP via
CONFIG_MFD_SYSCON -> CONFIG_REGMAP_MMIO -> CONFIG_REGMAP until
commit 8ecfaca7926f ("mux: mmio: add generic regmap bitfield-based
multiplexer").

> ../drivers/mux/mmio.c: In function ‘mux_mmio_probe’:
> ../drivers/mux/mmio.c:76:34: error: storage size of ‘field’ isn’t known
> 76 | struct reg_field field;
> | ^~~~~
> In file included from ../include/linux/bits.h:21,
> from ../include/linux/bitops.h:6,
> from ../drivers/mux/mmio.c:8:
> ../include/linux/bits.h:23:28: error: first argument to ‘__builtin_choose_expr’ not a constant
> 23 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
> | ^~~~~~~~~~~~~~~~~~~~~
> ../include/linux/build_bug.h:16:62: note: in definition of macro ‘BUILD_BUG_ON_ZERO’
> 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
> | ^
> ../include/linux/bits.h:37:10: note: in expansion of macro ‘GENMASK_INPUT_CHECK’
> 37 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
> | ^~~~~~~~~~~~~~~~~~~
> ../drivers/mux/mmio.c:96:29: note: in expansion of macro ‘GENMASK’
> 96 | if (mask != GENMASK(field.msb, field.lsb)) {
> | ^~~~~~~
> ../include/linux/build_bug.h:16:51: error: bit-field ‘<anonymous>’ width not an integer constant
> 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
> | ^
> ../include/linux/bits.h:23:10: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
> 23 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
> | ^~~~~~~~~~~~~~~~~
> ../include/linux/bits.h:37:10: note: in expansion of macro ‘GENMASK_INPUT_CHECK’
> 37 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
> | ^~~~~~~~~~~~~~~~~~~
> ../drivers/mux/mmio.c:96:29: note: in expansion of macro ‘GENMASK’
> 96 | if (mask != GENMASK(field.msb, field.lsb)) {
> | ^~~~~~~
> ../drivers/mux/mmio.c:102:29: error: implicit declaration of function ‘devm_regmap_field_alloc’ [-Werror=implicit-function-declaration]
> 102 | fields[i] = devm_regmap_field_alloc(dev, regmap, field);
> | ^~~~~~~~~~~~~~~~~~~~~~~
> ../drivers/mux/mmio.c:76:34: warning: unused variable ‘field’ [-Wunused-variable]
> 76 | struct reg_field field;
> | ^~~~~
>

Fixes: 8ecfaca7926f ("mux: mmio: add generic regmap bitfield-based multiplexer")

> Reported by: Randy Dunlap <[email protected]>
> Link: https://lore.kernel.org/lkml/[email protected]/
> Signed-off-by: Peter Rosin <[email protected]>
> ---
> drivers/mux/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> Note, there is a patch in linux-next that removes "|| COMPILE_TEST" from depends.
>
> Cheers,
> Peter
>
> diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig
> index 80f015cf6e54..9234f8c400ca 100644
> --- a/drivers/mux/Kconfig
> +++ b/drivers/mux/Kconfig
> @@ -48,6 +48,7 @@ config MUX_GPIO
> config MUX_MMIO
> tristate "MMIO/Regmap register bitfield-controlled Multiplexer"
> depends on OF
> + select REGMAP

I get a dependency loop with this:

drivers/net/ethernet/arc/Kconfig:19:error: recursive dependency detected!
drivers/net/ethernet/arc/Kconfig:19:symbol ARC_EMAC_CORE is selected by ARC_EMAC
drivers/net/ethernet/arc/Kconfig:26:symbol ARC_EMAC depends on OF_IRQ
drivers/of/Kconfig:69:symbol OF_IRQ depends on IRQ_DOMAIN
kernel/irq/Kconfig:60:symbol IRQ_DOMAIN is selected by REGMAP
drivers/base/regmap/Kconfig:6:symbol REGMAP is selected by MUX_MMIO
drivers/mux/Kconfig:48:symbol MUX_MMIO depends on MULTIPLEXER
drivers /mux/Kconfig:6:symbol MULTIPLEXER is selected by MDIO_BUS_MUX_MULTIPLEXER
drivers/net/mdio/Kconfig:261:symbol MDIO_BUS_MUX_MULTIPLEXER depends on MDIO_DEVICE
drivers/net/mdio/Kconfig:6:symbol MDIO_DEVICE is selected by PHYLIB
drivers/net/phy/Kconfig:16:symbol PHYLIB is selected by ARC_EMAC_CORE

(on next-20230210).

regards
Philipp

2023-05-24 13:22:36

by Peter Rosin

[permalink] [raw]
Subject: Re: [PATCH] mux: mmio: select REGMAP as the code has that dependency

Hi!

[sorry about the delay, busy-busy]

2023-02-10 at 12:56, Philipp Zabel wrote:
> On Fri, Feb 10, 2023 at 11:46:42AM +0100, Peter Rosin wrote:
>> If CONFIG_REGMAP is not active, the build errors out like this:
>
> The driver used to have an indirect dependency on CONFIG_REGMAP via
> CONFIG_MFD_SYSCON -> CONFIG_REGMAP_MMIO -> CONFIG_REGMAP until
> commit 8ecfaca7926f ("mux: mmio: add generic regmap bitfield-based
> multiplexer").
>
>> ../drivers/mux/mmio.c: In function ‘mux_mmio_probe’:
>> ../drivers/mux/mmio.c:76:34: error: storage size of ‘field’ isn’t known
>> 76 | struct reg_field field;
>> | ^~~~~
>> In file included from ../include/linux/bits.h:21,
>> from ../include/linux/bitops.h:6,
>> from ../drivers/mux/mmio.c:8:
>> ../include/linux/bits.h:23:28: error: first argument to ‘__builtin_choose_expr’ not a constant
>> 23 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
>> | ^~~~~~~~~~~~~~~~~~~~~
>> ../include/linux/build_bug.h:16:62: note: in definition of macro ‘BUILD_BUG_ON_ZERO’
>> 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
>> | ^
>> ../include/linux/bits.h:37:10: note: in expansion of macro ‘GENMASK_INPUT_CHECK’
>> 37 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
>> | ^~~~~~~~~~~~~~~~~~~
>> ../drivers/mux/mmio.c:96:29: note: in expansion of macro ‘GENMASK’
>> 96 | if (mask != GENMASK(field.msb, field.lsb)) {
>> | ^~~~~~~
>> ../include/linux/build_bug.h:16:51: error: bit-field ‘<anonymous>’ width not an integer constant
>> 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
>> | ^
>> ../include/linux/bits.h:23:10: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
>> 23 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
>> | ^~~~~~~~~~~~~~~~~
>> ../include/linux/bits.h:37:10: note: in expansion of macro ‘GENMASK_INPUT_CHECK’
>> 37 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
>> | ^~~~~~~~~~~~~~~~~~~
>> ../drivers/mux/mmio.c:96:29: note: in expansion of macro ‘GENMASK’
>> 96 | if (mask != GENMASK(field.msb, field.lsb)) {
>> | ^~~~~~~
>> ../drivers/mux/mmio.c:102:29: error: implicit declaration of function ‘devm_regmap_field_alloc’ [-Werror=implicit-function-declaration]
>> 102 | fields[i] = devm_regmap_field_alloc(dev, regmap, field);
>> | ^~~~~~~~~~~~~~~~~~~~~~~
>> ../drivers/mux/mmio.c:76:34: warning: unused variable ‘field’ [-Wunused-variable]
>> 76 | struct reg_field field;
>> | ^~~~~
>>
>
> Fixes: 8ecfaca7926f ("mux: mmio: add generic regmap bitfield-based multiplexer")

Right, I'll add that.

>> Reported by: Randy Dunlap <[email protected]>
>> Link: https://lore.kernel.org/lkml/[email protected]/
>> Signed-off-by: Peter Rosin <[email protected]>
>> ---
>> drivers/mux/Kconfig | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> Note, there is a patch in linux-next that removes "|| COMPILE_TEST" from depends.

Still true, haven't gotten around to pushing that upstream. Sorry. Busy-busy...

>>
>> Cheers,
>> Peter
>>
>> diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig
>> index 80f015cf6e54..9234f8c400ca 100644
>> --- a/drivers/mux/Kconfig
>> +++ b/drivers/mux/Kconfig
>> @@ -48,6 +48,7 @@ config MUX_GPIO
>> config MUX_MMIO
>> tristate "MMIO/Regmap register bitfield-controlled Multiplexer"
>> depends on OF
>> + select REGMAP
>
> I get a dependency loop with this:
>
> drivers/net/ethernet/arc/Kconfig:19:error: recursive dependency detected!
> drivers/net/ethernet/arc/Kconfig:19:symbol ARC_EMAC_CORE is selected by ARC_EMAC
> drivers/net/ethernet/arc/Kconfig:26:symbol ARC_EMAC depends on OF_IRQ
> drivers/of/Kconfig:69:symbol OF_IRQ depends on IRQ_DOMAIN
> kernel/irq/Kconfig:60:symbol IRQ_DOMAIN is selected by REGMAP
> drivers/base/regmap/Kconfig:6:symbol REGMAP is selected by MUX_MMIO
> drivers/mux/Kconfig:48:symbol MUX_MMIO depends on MULTIPLEXER
> drivers/mux/Kconfig:6:symbol MULTIPLEXER is selected by MDIO_BUS_MUX_MULTIPLEXER
> drivers/net/mdio/Kconfig:261:symbol MDIO_BUS_MUX_MULTIPLEXER depends on MDIO_DEVICE
> drivers/net/mdio/Kconfig:6:symbol MDIO_DEVICE is selected by PHYLIB
> drivers/net/phy/Kconfig:16:symbol PHYLIB is selected by ARC_EMAC_CORE
>
> (on next-20230210).

Right. It seemed so obvious that I failed to even compile test before
sending the patch. LART applied to self. Sorry.

I'll follow up with a v2 shortly.

Cheers,
Peter