linux/arch/mips/include/asm/mach-ralink
Tiezhu Yang 7e4fd16b38 MIPS: RALINK: Define pci_remap_iospace under CONFIG_PCI_DRIVERS_GENERIC
kernel test robot reports a build error used with clang compiler and
mips-randconfig [1]:

    ld.lld: error: undefined symbol: pci_remap_iospace

we can see the following configs in the mips-randconfig file:

    CONFIG_RALINK=y
    CONFIG_SOC_MT7620=y
    CONFIG_PCI_DRIVERS_LEGACY=y
    CONFIG_PCI=y

CONFIG_RALINK is set, so pci_remap_iospace is defined in the related
arch/mips/include/asm/mach-ralink/spaces.h header file:

    #define pci_remap_iospace pci_remap_iospace

CONFIG_PCI is set, so pci_remap_iospace() in drivers/pci/pci.c is not
built due to pci_remap_iospace is defined under CONFIG_RALINK.

    #ifndef pci_remap_iospace
    int pci_remap_iospace(const struct resource *res, ...)

    $ objdump -d drivers/pci/pci.o | grep pci_remap_iospace
    00004cc8 <devm_pci_remap_iospace>:
        4d18:	10400008 	beqz	v0,4d3c <devm_pci_remap_iospace+0x74>
        4d2c:	1040000c 	beqz	v0,4d60 <devm_pci_remap_iospace+0x98>
        4d70:	1000fff3 	b	4d40 <devm_pci_remap_iospace+0x78>

In addition, CONFIG_PCI_DRIVERS_GENERIC is not set, so pci_remap_iospace()
in arch/mips/pci/pci-generic.c is not built too.

    #ifdef pci_remap_iospace
    int pci_remap_iospace(const struct resource *res, ...)

For the above reasons, undefined reference pci_remap_iospace() looks like
reasonable.

Here are simple steps to reproduce used with gcc and defconfig:

    cd mips.git
    make vocore2_defconfig # set RALINK, SOC_MT7620, PCI_DRIVERS_LEGACY
    make menuconfig        # set PCI
    make

there exists the following build error:

      LD      vmlinux.o
      MODPOST vmlinux.symvers
      MODINFO modules.builtin.modinfo
      GEN     modules.builtin
      LD      .tmp_vmlinux.kallsyms1
    drivers/pci/pci.o: In function `devm_pci_remap_iospace':
    pci.c:(.text+0x4d24): undefined reference to `pci_remap_iospace'
    Makefile:1158: recipe for target 'vmlinux' failed
    make: *** [vmlinux] Error 1

Define pci_remap_iospace under CONFIG_PCI_DRIVERS_GENERIC can fix the build
error, with this patch, no build error remains. This patch is similar with
commit e538e86498 ("MIPS: asm: pci: define arch-specific
'pci_remap_iospace()' dependent on 'CONFIG_PCI_DRIVERS_GENERIC'").

[1] https://lore.kernel.org/lkml/202205251247.nQ5cxSV6-lkp@intel.com/

Fixes: 09d97da660 ("MIPS: Only define pci_remap_iospace() for Ralink")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
2022-05-26 10:12:11 +02:00
..
mt7620 MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mt7621 MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
rt288x MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
rt305x MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
rt3883 MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
irq.h MIPS: Add header files reference with path prefix 2020-03-19 13:12:27 +01:00
mt7620.h pinctrl: ralink: move MT7620 SoC pinmux config into a new 'pinctrl-mt7620.c' file 2021-06-07 09:17:47 +02:00
mt7621.h MIPS: ralink: mt7621: add memory detection support 2021-03-29 11:18:54 +02:00
ralink_regs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rt288x.h pinctrl: ralink: move RT288X SoC pinmux config into a new 'pinctrl-rt288x.c' file 2021-06-07 09:17:48 +02:00
rt305x.h pinctrl: ralink: move RT305X SoC pinmux config into a new 'pinctrl-rt305x.c' file 2021-06-07 09:17:47 +02:00
rt3883.h pinctrl: ralink: move RT3883 SoC pinmux config into a new 'pinctrl-rt3883.c' file 2021-06-07 09:17:47 +02:00
spaces.h MIPS: RALINK: Define pci_remap_iospace under CONFIG_PCI_DRIVERS_GENERIC 2022-05-26 10:12:11 +02:00