[PATCH 1/2] irqchip: Fixed LoongArch CPU interrupt types defined.

From: Yupeng Li
Date: Fri Aug 19 2022 - 03:29:18 EST


When CONFIG_LOONGSON_LIOINTC,CONFIG_LOONGSON_EIOINTC,
CONFIG_LOONGSON_PCH_LPC,CONFIG_LOONGSON_PCH_PIC was disabled,
build kernel with errors like:

MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
loongarch64-linux-gnu-ld: drivers/irqchip/irq-loongarch-cpu.o: in function `lpic_get_gsi_domain_id':
irq-loongarch-cpu.c:(.text+0x8): undefined reference to `pch_lpc_handle'
loongarch64-linux-gnu-ld: irq-loongarch-cpu.c:(.text+0xc): undefined reference to `pch_lpc_handle'
loongarch64-linux-gnu-ld: irq-loongarch-cpu.c:(.text+0xc): undefined reference to `pch_lpc_handle'
make: *** [Makefile:1171:vmlinux] 错误 1

Reviewed-by: Caicai <caizp2008@xxxxxxx>
Signed-off-by: Yupeng Li <liyupeng@xxxxxxxxxx>
---
drivers/irqchip/irq-loongarch-cpu.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/irqchip/irq-loongarch-cpu.c b/drivers/irqchip/irq-loongarch-cpu.c
index 327f3ab62c03..d296f704cbb6 100644
--- a/drivers/irqchip/irq-loongarch-cpu.c
+++ b/drivers/irqchip/irq-loongarch-cpu.c
@@ -27,24 +27,30 @@ static u32 lpic_gsi_to_irq(u32 gsi)

static struct fwnode_handle *lpic_get_gsi_domain_id(u32 gsi)
{
+#ifdef CONFIG_LOONGSON_PCH_PIC
int id;
+#endif
struct fwnode_handle *domain_handle = NULL;

switch (gsi) {
case GSI_MIN_CPU_IRQ ... GSI_MAX_CPU_IRQ:
+#ifdef CONFIG_LOONGSON_LIOINTC
if (liointc_handle)
domain_handle = liointc_handle;
+#endif
break;
-
case GSI_MIN_LPC_IRQ ... GSI_MAX_LPC_IRQ:
+#ifdef CONFIG_LOONGSON_PCH_LPC
if (pch_lpc_handle)
domain_handle = pch_lpc_handle;
+#endif
break;
-
case GSI_MIN_PCH_IRQ ... GSI_MAX_PCH_IRQ:
+#ifdef CONFIG_LOONGSON_PCH_PIC
id = find_pch_pic(gsi);
if (id >= 0 && pch_pic_handle[id])
domain_handle = pch_pic_handle[id];
+#endif
break;
}

@@ -92,6 +98,7 @@ static const struct irq_domain_ops loongarch_cpu_intc_irq_domain_ops = {
.xlate = irq_domain_xlate_onecell,
};

+#ifdef CONFIG_LOONGSON_LIOINTC
static int __init
liointc_parse_madt(union acpi_subtable_headers *header,
const unsigned long end)
@@ -100,7 +107,8 @@ liointc_parse_madt(union acpi_subtable_headers *header,

return liointc_acpi_init(irq_domain, liointc_entry);
}
-
+#endif
+#ifdef CONFIG_LOONGSON_EIOINTC
static int __init
eiointc_parse_madt(union acpi_subtable_headers *header,
const unsigned long end)
@@ -109,13 +117,17 @@ eiointc_parse_madt(union acpi_subtable_headers *header,

return eiointc_acpi_init(irq_domain, eiointc_entry);
}
-
+#endif
static int __init acpi_cascade_irqdomain_init(void)
{
+#ifdef CONFIG_LOONGSON_LIOINTC
acpi_table_parse_madt(ACPI_MADT_TYPE_LIO_PIC,
liointc_parse_madt, 0);
+#endif
+#ifdef CONFIG_LOONGSON_EIOINTC
acpi_table_parse_madt(ACPI_MADT_TYPE_EIO_PIC,
eiointc_parse_madt, 0);
+#endif
return 0;
}

--
2.34.1