[PATCH 2/2] LoongArch: Fixed Loongarch LOONGSON_PCH_MSI func built errors

From: Yupeng Li
Date: Fri Aug 19 2022 - 03:25:13 EST


When CONFIG_LOONGSON_PCH_MSI was disabled,kernel build
with errors like:

MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
loongarch64-linux-gnu-ld: arch/loongarch/pci/pci.o: in function `pcibios_device_add':
pci.c:(.text+0x1b8): undefined reference to `get_pch_msi_handle'
make: *** [Makefile:1171:vmlinux] 错误 1

Reviewed-by: Caicai <caizp2008@xxxxxxx>
Signed-off-by: Yupeng Li <liyupeng@xxxxxxxxxx>
---
arch/loongarch/pci/pci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/loongarch/pci/pci.c b/arch/loongarch/pci/pci.c
index e9b7c34d9b6d..44cf57dafcdf 100644
--- a/arch/loongarch/pci/pci.c
+++ b/arch/loongarch/pci/pci.c
@@ -65,13 +65,14 @@ subsys_initcall(pcibios_init);

int pcibios_device_add(struct pci_dev *dev)
{
+#ifdef CONFIG_LOONGSON_PCH_MSI
int id;
struct irq_domain *dom;

id = pci_domain_nr(dev->bus);
dom = irq_find_matching_fwnode(get_pch_msi_handle(id), DOMAIN_BUS_PCI_MSI);
dev_set_msi_domain(&dev->dev, dom);
-
+#endif
return 0;
}

--
2.34.1