Dear Thierry Reding, On Mon, 29 Jul 2013 14:58:27 +0200, Thierry Reding wrote: > > /** > > + * irq_find_msi() - Locates a MSI domain for a given device node > > + * @node: device-tree node of the interrupt controller > > + */ > > +struct irq_domain *irq_find_msi(struct device_node *node) > > +{ > > + struct irq_domain *h, *found = NULL; > > + > > + mutex_lock(&irq_domain_mutex); > > + list_for_each_entry(h, &irq_domain_list, link) { > > + if (!h->msi_chip) > > + continue; > > + if (h->of_node && h->of_node == node) { > > + found = h; > > + break; > > + } > > + } > > + mutex_unlock(&irq_domain_mutex); > > + return found; > > +} > > +EXPORT_SYMBOL_GPL(irq_find_msi); > > This doesn't quite copy what irq_find_host() does, since it ignores the > associated ops->match(). Correct. > But given that ops->match() already provides a way to hook into the > lookup, perhaps we could add a function such as this: > > int irq_domain_supports_msi(struct irq_domain *d, struct device_node *node) > { > if ((d->of_node == NULL) || (d->of_node != node)) > return 0; > > return d->msi_chip != NULL; > } > > Then use that in drivers that expose MSI functionality via an IRQ domain > like this: > > static const struct irq_domain_ops foo_irq_domain_ops = { > ... > .match = irq_domain_supports_msi, > ... > }; > > One problem with this is that it doesn't solve your problem where two > different IRQ domains are exposed by the same device, because the > irq_find_host() will still match the MSI IRQ domain for the non-MSI > device node as well. Indeed. > This could be solved by adding another match function... But this would involve changing all the users of irq_find_host(), no? > This goes in hand with the helper-style API that I mentioned above. But > it's really up to Grant to decide which way he wants this to go. Yes, Grant, your suggestions are welcome on this. Thanks! Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html