Bug 209889

Summary: iio: adc: build error due to unmet dependency for MFD_STM32_TIMERS by STM32_ADC_CORE
Product: Drivers Reporter: Necip Fazil Yildiran (fazilyildiran)
Component: IIOAssignee: Virtual Assignee for Drivers/IIO (drivers_iio)
Status: RESOLVED CODE_FIX    
Severity: normal CC: andy.shevchenko, fazilyildiran, lars, paul
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.10rc1 Subsystem:
Regression: No Bisected commit-id:
Attachments: reproduce.tar.gz

Description Necip Fazil Yildiran 2020-10-26 22:46:02 UTC
Created attachment 293235 [details]
reproduce.tar.gz

Attachment (reproduce.tar.gz) content:
 - sample.config: Config file to reproduce the bug.
 - build_out.txt: Output of Kbuild including the error messages.

When MFD_STM32_TIMERS is enabled and HAS_IOMEM is disabled, it results in the
following Kbuild warning:

WARNING: unmet direct dependencies detected for MFD_STM32_TIMERS
  Depends on [n]: HAS_IOMEM [=n] && (ARCH_STM32 && OF [=y] || COMPILE_TEST [=y])
  Selected by [y]:
  - STM32_ADC_CORE [=y] && IIO [=y] && (ARCH_STM32 || COMPILE_TEST [=y]) && OF [=y] && REGULATOR [=y]

Building the kernel fails due to this unmet direct dependency issue as follows:

[...]
  LD      .tmp_vmlinux1
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/irqchip/irq-renesas-rza1.o: in function `rza1_irqc_probe':
irq-renesas-rza1.c:(.text+0x2b0): undefined reference to `devm_platform_ioremap_resource'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/phy/marvell/phy-mvebu-a3700-utmi.o: in function `mvebu_a3700_utmi_phy_probe':
phy-mvebu-a3700-utmi.c:(.text+0x3e6): undefined reference to `devm_ioremap_resource'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/phy/ti/phy-omap-control.o: in function `omap_control_phy_probe':
phy-omap-control.c:(.text+0x1d0): undefined reference to `devm_ioremap_resource'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: phy-omap-control.c:(.text+0x210): undefined reference to `devm_ioremap_resource'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: phy-omap-control.c:(.text+0x282): undefined reference to `devm_ioremap_resource'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/soc/bcm/brcmstb/common.o: in function `brcmstb_soc_device_early_init':
common.c:(.init.text+0x196): undefined reference to `of_iomap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: common.c:(.init.text+0x1c2): undefined reference to `iounmap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/soc/bcm/brcmstb/biuctrl.o: in function `brcmstb_biuctrl_init':
biuctrl.c:(.init.text+0x42): undefined reference to `of_iomap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/soc/fsl/dpaa2-console.o: in function `dpaa2_console_close':
dpaa2-console.c:(.text+0x5a): undefined reference to `iounmap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/soc/fsl/dpaa2-console.o: in function `dpaa2_console_probe':
dpaa2-console.c:(.text+0xe2): undefined reference to `of_address_to_resource'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/soc/fsl/dpaa2-console.o: in function `dpaa2_generic_console_open.isra.0.constprop.0':
dpaa2-console.c:(.text+0x334): undefined reference to `ioremap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: dpaa2-console.c:(.text+0x388): undefined reference to `iounmap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: dpaa2-console.c:(.text+0x39e): undefined reference to `ioremap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: dpaa2-console.c:(.text+0x414): undefined reference to `iounmap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/char/hw_random/exynos-trng.o: in function `exynos_trng_probe':
exynos-trng.c:(.text+0xfc): undefined reference to `devm_ioremap_resource'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/char/hw_random/meson-rng.o: in function `meson_rng_probe':
meson-rng.c:(.text+0x78): undefined reference to `devm_ioremap_resource'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/char/hw_random/mtk-rng.o: in function `mtk_rng_probe':
mtk-rng.c:(.text+0xbe): undefined reference to `devm_ioremap_resource'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/mfd/stm32-timers.o: in function `stm32_timers_probe':
stm32-timers.c:(.text+0x12c): undefined reference to `devm_ioremap_resource'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: stm32-timers.c:(.text+0x16c): undefined reference to `__devm_regmap_init_mmio_clk'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/pcmcia/cistpl.o: in function `set_cis_map':
cistpl.c:(.text+0x20c): undefined reference to `ioremap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: cistpl.c:(.text+0x246): undefined reference to `iounmap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: cistpl.c:(.text+0x2cc): undefined reference to `iounmap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: cistpl.c:(.text+0x2de): undefined reference to `ioremap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/pcmcia/cistpl.o: in function `release_cis_mem':
(.text+0x13e0): undefined reference to `iounmap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/clocksource/timer-of.o: in function `timer_of_init':
timer-of.c:(.init.text+0x40): undefined reference to `of_iomap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: timer-of.c:(.init.text+0x96): undefined reference to `iounmap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/clocksource/timer-of.o: in function `timer_of_cleanup':
timer-of.c:(.init.text+0x274): undefined reference to `iounmap'
/home/necip/0day/gcc-9.3.0-nolibc/s390-linux/bin/s390-linux-ld: drivers/iio/adc/stm32-adc-core.o: in function `stm32_adc_probe':
stm32-adc-core.c:(.text+0x498): undefined reference to `devm_ioremap_resource'
Makefile:1077: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

Steps to reproduce the bug for v5.4.4:
  1. wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
  2. chmod +x ~/bin/make.cross
  3. tar -xvf reproduce.tar.gz # sample.config and build_out.txt
  4. cp sample.config path/to/linux-source-v5.4.4/.config
  5. cd path/to/linux-source-v5.4.4/
  6. ~/bin/make.cross ARCH=TODO_ARCH clean
  7. ~/bin/make.cross ARCH=TODO_ARCH olddefconfig # unmet direct dependency warning
  8. ~/bin/make.cross ARCH=TODO_ARCH # should have a build error

The output for the steps [6-8] can be found in build_out.txt.

The bug is reproducible for v5.10-rc1 as well with the same steps.

Kernel successfully builds when the unmet direct dependencies are resolved
by enabling them in the configuration. Depending on instead of selecting
the symbols, or selecting the dependencies of the selected symbols as well
might fix the bug.

Thanks,
Necip
Comment 1 Andy Shevchenko 2021-06-08 08:28:30 UTC
commit 121875b28e3bd7519a675bf8ea2c2e793452c2bd
Author: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Date:   Sun Jan 24 19:50:34 2021 +0000

    iio:adc:stm32-adc: Add HAS_IOMEM dependency
    
    Seems that there are config combinations in which this driver gets enabled
    and hence selects the MFD, but with out HAS_IOMEM getting pulled in
    via some other route.  MFD is entirely contained in an
    if HAS_IOMEM block, leading to the build issue in this bugzilla.
    
    https://bugzilla.kernel.org/show_bug.cgi?id=209889