2020-01-03 05:46:39

by Paul Gazzillo

[permalink] [raw]
Subject: Apparent Kconfig bug for Maxim 77650 driver

It seems there is a Kconfig issue that causing a linking error for drivers/mfd/max77650.c. It happens when CONFIG_MFD_MAX77650 is set (which controls drivers/mfd/max77650.c), but CONFIG_REGMAP_IRQ is not. CONFIG_REMAP_IRQ controls drivers/base/regmap/regmap-irq.c, which has functions called by max77650.c.

In drivers/mfd/Kconfig, it looks like CONFIG_MFD_MAX77650 is meant to have "select CONFIG_REGMAP_IRQ" like several other configuration options from the same Kconfig file.

Steps to reproduce the bug for next-20191220 (also happens on other versions, e.g., v5.4.4):

1. make allnoconfig # using x86
2. make menuconfig
a. Enable device drivers->i2c support
b. Enable device drivers->device tree and open firmware support
c. Enable device drivers->multifunction devices->maxim MAX77650
3. make # should have a build error when linking vmlinux

This is the build error I get:

ld: drivers/mfd/max77650.o: in function `max77650_i2c_probe':
max77650.c:(.text+0xcb): undefined reference to `devm_regmap_add_irq_chip'
ld: max77650.c:(.text+0xdb): undefined reference to `regmap_irq_get_domain'
make: *** [Makefile:1079: vmlinux] Error 1

Is this a real bug or am I doing something wrong?

Best,
Paul


2020-01-03 11:45:34

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: Apparent Kconfig bug for Maxim 77650 driver

pt., 3 sty 2020 o 06:45 Paul Gazzillo <[email protected]> napisaƂ(a):
>
> It seems there is a Kconfig issue that causing a linking error for drivers/mfd/max77650.c. It happens when CONFIG_MFD_MAX77650 is set (which controls drivers/mfd/max77650.c), but CONFIG_REGMAP_IRQ is not. CONFIG_REMAP_IRQ controls drivers/base/regmap/regmap-irq.c, which has functions called by max77650.c.
>
> In drivers/mfd/Kconfig, it looks like CONFIG_MFD_MAX77650 is meant to have "select CONFIG_REGMAP_IRQ" like several other configuration options from the same Kconfig file.
>
> Steps to reproduce the bug for next-20191220 (also happens on other versions, e.g., v5.4.4):
>
> 1. make allnoconfig # using x86
> 2. make menuconfig
> a. Enable device drivers->i2c support
> b. Enable device drivers->device tree and open firmware support
> c. Enable device drivers->multifunction devices->maxim MAX77650
> 3. make # should have a build error when linking vmlinux
>
> This is the build error I get:
>
> ld: drivers/mfd/max77650.o: in function `max77650_i2c_probe':
> max77650.c:(.text+0xcb): undefined reference to `devm_regmap_add_irq_chip'
> ld: max77650.c:(.text+0xdb): undefined reference to `regmap_irq_get_domain'
> make: *** [Makefile:1079: vmlinux] Error 1
>
> Is this a real bug or am I doing something wrong?
>
> Best,
> Paul

It's a bug, thanks for reporting. I just sent out a fix.

Best regards,
Bartosz Golaszewski

PS please set your e-mail client to wrap lines around 80 characters
when posting to LKML.