genirq/msi: Provide msi_domain_ops:: Post_free()
authorThomas Gleixner <tglx@linutronix.de>
Fri, 11 Nov 2022 13:54:27 +0000 (14:54 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 17 Nov 2022 14:15:19 +0000 (15:15 +0100)
To prepare for removing the exposure of __msi_domain_free_irqs() provide a
post_free() callback in the MSI domain ops which can be used to solve
the problem of the only user of __msi_domain_free_irqs() in arch/powerpc.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ashok Raj <ashok.raj@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20221111122014.063153448@linutronix.de
include/linux/msi.h
kernel/irq/msi.c

index 9b552ee..7f6aba9 100644 (file)
@@ -315,6 +315,8 @@ struct msi_domain_info;
  *                     function.
  * @domain_free_irqs:  Optional function to override the default free
  *                     function.
+ * @msi_post_free:     Optional function which is invoked after freeing
+ *                     all interrupts.
  *
  * @get_hwirq, @msi_init and @msi_free are callbacks used by the underlying
  * irqdomain.
@@ -359,6 +361,8 @@ struct msi_domain_ops {
                                             struct device *dev, int nvec);
        void            (*domain_free_irqs)(struct irq_domain *domain,
                                            struct device *dev);
+       void            (*msi_post_free)(struct irq_domain *domain,
+                                        struct device *dev);
 };
 
 /**
index 3ccc7f6..c71c37d 100644 (file)
@@ -1026,6 +1026,8 @@ void msi_domain_free_irqs_descs_locked(struct irq_domain *domain, struct device
        lockdep_assert_held(&dev->msi.data->mutex);
 
        ops->domain_free_irqs(domain, dev);
+       if (ops->msi_post_free)
+               ops->msi_post_free(domain, dev);
        msi_domain_free_msi_descs(info, dev);
 }