[tip: irq/drivers] irqchip/al-fic: Keep the device_node instead of a cached name string

From: tip-bot2 for Eliav Farber

Date: Thu Oct 15 2026 - 08:41:30 EST


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

Commit-ID: 455c9664aa6940b44a4d0e92f6a5850afb1d8435
Gitweb: https://git.kernel.org/tip/455c9664aa6940b44a4d0e92f6a5850afb1d8435
Author: Eliav Farber <farbere@xxxxxxxxxx>
AuthorDate: Sun, 11 Oct 2026 05:04:43
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Thu, 15 Oct 2026 14:25:06 +02:00

irqchip/al-fic: Keep the device_node instead of a cached name string

struct al_fic cached a const char *name that al_fic_wire_init() set
from node->name. That string pointed into the device_node, so the
driver already depended on the node outliving init, but nothing in the
struct said so.

Keep the device_node itself and derive the name where it is needed. The
dependency does not go away: of_node_full_name() also returns a pointer
into the node, and irq_alloc_domain_generic_chips() keeps the string it
is given.

The driver therefore needs its own reference. of_irq_init() holds one
across the init callback, but since commit 30724547b221 ("of/irq: Fix
remaining refcount leaks in of_irq_init()") it drops that reference
again when it drains its parent list. Take a reference where the
pointer is stored and drop it on the error path. The driver is
__init-only with no teardown, so on success it is held for the life of
the system.

Deriving the name this way also changes the generic chip name from the
bare node name (e.g. "interrupt-controller") to the full name including
the unit address (e.g. "interrupt-controller@fd8a8500"), which keeps
instances that share a bare name distinguishable.

Signed-off-by: Eliav Farber <farbere@xxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Reviewed-by: Radu Rendec <radu@xxxxxxxxxx>
Link: https://patch.msgid.link/20261011050449.41903-5-farbere@xxxxxxxxxx
---
drivers/irqchip/irq-al-fic.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/irqchip/irq-al-fic.c b/drivers/irqchip/irq-al-fic.c
index ac979c3..30740d7 100644
--- a/drivers/irqchip/irq-al-fic.c
+++ b/drivers/irqchip/irq-al-fic.c
@@ -36,7 +36,7 @@ enum al_fic_state {
struct al_fic {
void __iomem *base;
struct irq_domain *domain;
- const char *name;
+ struct device_node *node;
unsigned int parent_irq;
enum al_fic_state state;
};
@@ -88,7 +88,7 @@ static int al_fic_irq_set_type(struct irq_data *data, unsigned int flow_type)
if (fic->state == AL_FIC_UNCONFIGURED) {
al_fic_set_trigger(fic, gc, new_state);
} else if (fic->state != new_state) {
- pr_debug("fic %s state already configured to %d\n", fic->name, fic->state);
+ pr_debug("fic %pOF state already configured to %d\n", fic->node, fic->state);
return -EINVAL;
}
return 0;
@@ -137,7 +137,7 @@ static int al_fic_register(struct device_node *node, struct al_fic *fic)
}

ret = irq_alloc_domain_generic_chips(fic->domain, NR_FIC_IRQS,
- 1, fic->name, handle_level_irq,
+ 1, of_node_full_name(fic->node), handle_level_irq,
0, 0, IRQ_GC_INIT_MASK_CACHE);
if (ret) {
pr_err("fail to allocate generic chip (%d)\n", ret);
@@ -166,9 +166,8 @@ err_domain_remove:

/*
* al_fic_wire_init() - initialize and configure fic in wire mode
- * @of_node: optional pointer to interrupt controller's device tree node.
+ * @node: pointer to the interrupt controller's device tree node
* @base: mmio to fic register
- * @name: name of the fic
* @parent_irq: interrupt of parent
*
* This API will configure the fic hardware to work in wire mode.
@@ -177,7 +176,7 @@ err_domain_remove:
* to be determined based on connected hardware to this fic.
*/
static struct al_fic *al_fic_wire_init(struct device_node *node, void __iomem *base,
- const char *name, unsigned int parent_irq)
+ unsigned int parent_irq)
{
u32 control = CONTROL_MASK_MSI_X;
struct al_fic *fic;
@@ -189,7 +188,7 @@ static struct al_fic *al_fic_wire_init(struct device_node *node, void __iomem *b

fic->base = base;
fic->parent_irq = parent_irq;
- fic->name = name;
+ fic->node = of_node_get(node);

/* mask out all interrupts */
writel_relaxed(0xFFFFFFFF, fic->base + AL_FIC_MASK);
@@ -211,6 +210,7 @@ static struct al_fic *al_fic_wire_init(struct device_node *node, void __iomem *b
return fic;

err_free:
+ of_node_put(fic->node);
kfree(fic);
return ERR_PTR(ret);
}
@@ -240,7 +240,7 @@ static int __init al_fic_init_dt(struct device_node *node, struct device_node *p
goto err_unmap;
}

- fic = al_fic_wire_init(node, base, node->name, parent_irq);
+ fic = al_fic_wire_init(node, base, parent_irq);

if (IS_ERR(fic)) {
pr_err("%pOF: fail to initialize irqchip (%pe)\n", node, fic);