Skip to contentSkip to conversation

irqchip/dw-apb-ictl: Support building as module

PATCH Applied Jisheng Zhang 2 participants 2 messages Jun 14, 2024 – Jun 23, 2024 irqchip drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irqchip/dw-apb-ictl: Support building as module

Allow the user selection and building of this interrupt controller driver as a module, for example, in some synaptics arm64 SoCs it is used as a second level interrupt controller hanging off the ARM GIC and is therefore loadable during boot.

However, this interrupt controller can also be used as the main interrupt controller by other platforms, so we must keep this kind of support by checking whether DW_APB_ICTL is builtin or not.

---
 drivers/irqchip/Kconfig           |  2 +-
 drivers/irqchip/irq-dw-apb-ictl.c | 13 ++++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/irqchip/Kconfig +1 -1
index 14464716bacb..cfd1102eb273 100644
@@ -145,7 +145,7 @@ config DAVINCI_CP_INTC
 	select IRQ_DOMAIN
 
 config DW_APB_ICTL
-	bool
+	tristate "DesignWare APB Interrupt Controller"
 	select GENERIC_IRQ_CHIP
 	select IRQ_DOMAIN_HIERARCHY
 
drivers/irqchip/irq-dw-apb-ictl.c +10 -3
index d5c1c750c8d2..5eda6c4689cf 100644
@@ -122,7 +122,7 @@ static int __init dw_apb_ictl_init(struct device_node *np,
 	int ret, nrirqs, parent_irq, i;
 	u32 reg;
 
-	if (!parent) {
+	if (!parent && IS_BUILTIN(CONFIG_DW_APB_ICTL)) {
 		/* Used as the primary interrupt controller */
 		parent_irq = 0;
 		domain_ops = &dw_apb_ictl_irq_domain_ops;
@@ -214,5 +214,12 @@ static int __init dw_apb_ictl_init(struct device_node *np,
 	release_mem_region(r.start, resource_size(&r));
 	return ret;
 }
-IRQCHIP_DECLARE(dw_apb_ictl,
-		"snps,dw-apb-ictl", dw_apb_ictl_init);
+#if IS_BUILTIN(CONFIG_DW_APB_ICTL)
+IRQCHIP_DECLARE(dw_apb_ictl, "snps,dw-apb-ictl", dw_apb_ictl_init);
+#else
+IRQCHIP_PLATFORM_DRIVER_BEGIN(dw_apb_ictl)
+IRQCHIP_MATCH("snps,dw-apb-ictl", dw_apb_ictl_init)
+IRQCHIP_PLATFORM_DRIVER_END(dw_apb_ictl)
+MODULE_DESCRIPTION("DesignWare APB Interrupt Controller");
+MODULE_LICENSE("GPL v2");
+#endif
Signature · 1 line
2.43.0
merge bot Applied
#1 lore raw
The following commit has been merged into the irq/core branch of tip:

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     7cc4f309c933ec5d64eea31066fe86bbf9e48819
Gitweb:        https://git.kernel.org/tip/7cc4f309c933ec5d64eea31066fe86bbf9e48819
Author:        Jisheng Zhang <[email protected]>
AuthorDate:    Fri, 14 Jun 2024 23:34:49 +08:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Sun, 23 Jun 2024 19:49:44 +02:00

irqchip/dw-apb-ictl: Support building as module

The driver is now always built in. In some synaptics ARM64 SoCs it is used as a second level interrupt controller hanging off the ARM GIC and is therefore loadable during boot.

Enable it to be built as a module and handle built-in usage correctly, so that it continues working on systems where it is the main interrupt controller.

[ tglx: Massage changelog ]

---
 drivers/irqchip/Kconfig           |  2 +-
 drivers/irqchip/irq-dw-apb-ictl.c | 13 ++++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/irqchip/Kconfig +1 -1
index 348f345..aaf8453 100644
@@ -145,7 +145,7 @@ config DAVINCI_CP_INTC
 	select IRQ_DOMAIN
 
 config DW_APB_ICTL
-	bool
+	tristate "DesignWare APB Interrupt Controller"
 	select GENERIC_IRQ_CHIP
 	select IRQ_DOMAIN_HIERARCHY
 
drivers/irqchip/irq-dw-apb-ictl.c +10 -3
index d5c1c75..5eda6c4 100644
@@ -122,7 +122,7 @@ static int __init dw_apb_ictl_init(struct device_node *np,
 	int ret, nrirqs, parent_irq, i;
 	u32 reg;
 
-	if (!parent) {
+	if (!parent && IS_BUILTIN(CONFIG_DW_APB_ICTL)) {
 		/* Used as the primary interrupt controller */
 		parent_irq = 0;
 		domain_ops = &dw_apb_ictl_irq_domain_ops;
@@ -214,5 +214,12 @@ err_release:
 	release_mem_region(r.start, resource_size(&r));
 	return ret;
 }
-IRQCHIP_DECLARE(dw_apb_ictl,
-		"snps,dw-apb-ictl", dw_apb_ictl_init);
+#if IS_BUILTIN(CONFIG_DW_APB_ICTL)
+IRQCHIP_DECLARE(dw_apb_ictl, "snps,dw-apb-ictl", dw_apb_ictl_init);
+#else
+IRQCHIP_PLATFORM_DRIVER_BEGIN(dw_apb_ictl)
+IRQCHIP_MATCH("snps,dw-apb-ictl", dw_apb_ictl_init)
+IRQCHIP_PLATFORM_DRIVER_END(dw_apb_ictl)
+MODULE_DESCRIPTION("DesignWare APB Interrupt Controller");
+MODULE_LICENSE("GPL v2");
+#endif