Thread (112 messages) 112 messages, 18 authors, 2023-01-15

Re: [patch V2 04/46] genirq/chip: Use the first chip in irq_chip_compose_msi_msg()

From: Marc Zyngier <maz@kernel.org>
Date: 2020-08-26 21:32:09
Also in: linux-iommu, linux-pci, lkml, xen-devel

On Wed, 26 Aug 2020 22:19:56 +0100,
Thomas Gleixner [off-list ref] wrote:
On Wed, Aug 26 2020 at 20:50, Marc Zyngier wrote:
quoted
On Wed, 26 Aug 2020 12:16:32 +0100,
Thomas Gleixner [off-list ref] wrote:
quoted
---
V2: New patch. Note, that this might break other stuff which relies on the
    current behaviour, but the hierarchy composition of DT based chips is
    really hard to follow.
[...]
quoted hunk ↗ jump to hunk
What about the below?

Thanks,

        tglx
---
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -473,6 +473,15 @@ static inline void irq_domain_deactivate
 }
 #endif
 
+static inline struct irq_data *irqd_get_parent_data(struct irq_data *irqd)
+{
+#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
+	return irqd->parent_data;
+#else
+	return NULL;
+#endif
+}
+
We obviously should have had this forever.
quoted hunk ↗ jump to hunk
 #ifdef CONFIG_GENERIC_IRQ_DEBUGFS
 #include <linux/debugfs.h>
 
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -1541,18 +1541,17 @@ EXPORT_SYMBOL_GPL(irq_chip_release_resou
  */
 int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
 {
-	struct irq_data *pos = NULL;
+	struct irq_data *pos;
 
-#ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
-	for (; data; data = data->parent_data)
-#endif
+	for (pos = NULL; !pos && data; data = irqd_get_parent_data(data)) {
 		if (data->chip && data->chip->irq_compose_msi_msg)
 			pos = data;
+	}
+
 	if (!pos)
 		return -ENOSYS;
 
 	pos->chip->irq_compose_msi_msg(pos, msg);
-
 	return 0;
 }
Perfect, ship it! ;-)

	M.

-- 
Without deviation from the norm, progress is not possible.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help