[tip: irq/drivers] genirq/irqdomain: Add devm_irq_domain_create_linear()
From: tip-bot2 for Zhipeng Wang
Date: Mon Nov 09 2026 - 04:10:12 EST
The following commit has been merged into the irq/drivers branch of tip:
Commit-ID: 51987720c2845807161f56f4714df4562f56f328
Gitweb: https://git.kernel.org/tip/51987720c2845807161f56f4714df4562f56f328
Author: Zhipeng Wang <zhipeng.wang_1@xxxxxxx>
AuthorDate: Wed, 04 Nov 2026 16:37:57 +09:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Mon, 09 Nov 2026 10:01:08 +01:00
genirq/irqdomain: Add devm_irq_domain_create_linear()
irq_domain_create_linear() has no devres-managed counterpart, so a
driver that wants a linear revmap domain tied to the device lifetime has
to open-code an irq_domain_info and call devm_irq_domain_instantiate()
directly.
Add devm_irq_domain_create_linear() as the devres-managed sibling of
irq_domain_create_linear(): it builds the same linear-revmap
irq_domain_info and hands it to devm_irq_domain_instantiate(), so the
domain is removed when the owning device is unbound. The return
convention matches irq_domain_create_linear() (NULL on failure).
Signed-off-by: Zhipeng Wang <zhipeng.wang_1@xxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
Reviewed-by: Radu Rendec <radu@xxxxxxxxxx>
Link: https://patch.msgid.link/20261104073759.386777-10-Zhipeng.wang_1@xxxxxxxxxxx
---
include/linux/irqdomain.h | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 3ba75a4..d8caafc 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -457,6 +457,36 @@ static inline struct irq_domain *irq_domain_create_linear(struct fwnode_handle *
return IS_ERR(d) ? NULL : d;
}
+/**
+ * devm_irq_domain_create_linear - Allocate and register a linear revmap
+ * irq_domain tied to the device lifetime.
+ * @dev: Device that owns the domain. The domain is removed via devres
+ * when the device is unbound.
+ * @fwnode: pointer to interrupt controller's FW node.
+ * @size: Number of interrupts in the domain.
+ * @ops: map/unmap domain callbacks
+ * @host_data: Controller private data pointer
+ *
+ * Returns: Newly created irq_domain, or NULL on failure.
+ */
+static inline struct irq_domain *devm_irq_domain_create_linear(struct device *dev,
+ struct fwnode_handle *fwnode,
+ unsigned int size,
+ const struct irq_domain_ops *ops,
+ void *host_data)
+{
+ const struct irq_domain_info info = {
+ .fwnode = fwnode,
+ .size = size,
+ .hwirq_max = size,
+ .ops = ops,
+ .host_data = host_data,
+ };
+ struct irq_domain *d = devm_irq_domain_instantiate(dev, &info);
+
+ return IS_ERR(d) ? NULL : d;
+}
+
static inline struct irq_domain *irq_domain_create_tree(struct fwnode_handle *fwnode,
const struct irq_domain_ops *ops,
void *host_data)