genirq/msi: Split msi_create_irq_domain()
authorThomas Gleixner <tglx@linutronix.de>
Thu, 24 Nov 2022 23:25:52 +0000 (00:25 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 5 Dec 2022 18:21:01 +0000 (19:21 +0100)
Split the functionality of msi_create_irq_domain() so it can
be reused for creating per device irq domains.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221124232325.559086358@linutronix.de
kernel/irq/msi.c

index 0a3890598b7570c8f5f06dec8e4dfc32d4a1e51d..0f7fe562b307cc618d92dee662a3a9e15e82fa38 100644 (file)
@@ -758,17 +758,10 @@ static void msi_domain_update_chip_ops(struct msi_domain_info *info)
                chip->irq_set_affinity = msi_domain_set_affinity;
 }
 
-/**
- * msi_create_irq_domain - Create an MSI interrupt domain
- * @fwnode:    Optional fwnode of the interrupt controller
- * @info:      MSI domain info
- * @parent:    Parent irq domain
- *
- * Return: pointer to the created &struct irq_domain or %NULL on failure
- */
-struct irq_domain *msi_create_irq_domain(struct fwnode_handle *fwnode,
-                                        struct msi_domain_info *info,
-                                        struct irq_domain *parent)
+static struct irq_domain *__msi_create_irq_domain(struct fwnode_handle *fwnode,
+                                                 struct msi_domain_info *info,
+                                                 unsigned int flags,
+                                                 struct irq_domain *parent)
 {
        struct irq_domain *domain;
 
@@ -787,7 +780,7 @@ struct irq_domain *msi_create_irq_domain(struct fwnode_handle *fwnode,
        if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS)
                msi_domain_update_chip_ops(info);
 
-       domain = irq_domain_create_hierarchy(parent, IRQ_DOMAIN_FLAG_MSI, 0,
+       domain = irq_domain_create_hierarchy(parent, flags | IRQ_DOMAIN_FLAG_MSI, 0,
                                             fwnode, &msi_domain_ops, info);
 
        if (domain) {
@@ -799,6 +792,21 @@ struct irq_domain *msi_create_irq_domain(struct fwnode_handle *fwnode,
        return domain;
 }
 
+/**
+ * msi_create_irq_domain - Create an MSI interrupt domain
+ * @fwnode:    Optional fwnode of the interrupt controller
+ * @info:      MSI domain info
+ * @parent:    Parent irq domain
+ *
+ * Return: pointer to the created &struct irq_domain or %NULL on failure
+ */
+struct irq_domain *msi_create_irq_domain(struct fwnode_handle *fwnode,
+                                        struct msi_domain_info *info,
+                                        struct irq_domain *parent)
+{
+       return __msi_create_irq_domain(fwnode, info, 0, parent);
+}
+
 /**
  * msi_parent_init_dev_msi_info - Delegate initialization of device MSI info down
  *                               in the domain hierarchy