Commit f4823590 authored by Thomas Gleixner's avatar Thomas Gleixner

PCI/MSI: Simplify pci_irq_get_affinity()

Replace open coded MSI descriptor chasing and use the proper accessor
functions instead.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarMichael Kelley <mikelley@microsoft.com>
Tested-by: default avatarNishanth Menon <nm@ti.com>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20211210221814.900929381@linutronix.de
parent 82ff8e6b
...@@ -1104,26 +1104,20 @@ EXPORT_SYMBOL(pci_irq_vector); ...@@ -1104,26 +1104,20 @@ EXPORT_SYMBOL(pci_irq_vector);
*/ */
const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr) const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr)
{ {
if (dev->msix_enabled) { int irq = pci_irq_vector(dev, nr);
struct msi_desc *entry; struct msi_desc *desc;
for_each_pci_msi_entry(entry, dev) {
if (entry->msi_index == nr)
return &entry->affinity->mask;
}
WARN_ON_ONCE(1);
return NULL;
} else if (dev->msi_enabled) {
struct msi_desc *entry = first_pci_msi_entry(dev);
if (WARN_ON_ONCE(!entry || !entry->affinity || if (WARN_ON_ONCE(irq <= 0))
nr >= entry->nvec_used))
return NULL; return NULL;
return &entry->affinity[nr].mask; desc = irq_get_msi_desc(irq);
} else { /* Non-MSI does not have the information handy */
if (!desc)
return cpu_possible_mask; return cpu_possible_mask;
}
if (WARN_ON_ONCE(!desc->affinity))
return NULL;
return &desc->affinity[nr].mask;
} }
EXPORT_SYMBOL(pci_irq_get_affinity); EXPORT_SYMBOL(pci_irq_get_affinity);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment