Commit 82ff8e6b authored by Thomas Gleixner's avatar Thomas Gleixner

PCI/MSI: Use msi_get_virq() in pci_get_vector()

Use msi_get_vector() and handle the return value to be compatible.

No functional change intended.
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.841243231@linutronix.de
parent cf15f43a
...@@ -1080,28 +1080,13 @@ EXPORT_SYMBOL(pci_free_irq_vectors); ...@@ -1080,28 +1080,13 @@ EXPORT_SYMBOL(pci_free_irq_vectors);
*/ */
int pci_irq_vector(struct pci_dev *dev, unsigned int nr) int pci_irq_vector(struct pci_dev *dev, unsigned int nr)
{ {
if (dev->msix_enabled) { unsigned int irq;
struct msi_desc *entry;
for_each_pci_msi_entry(entry, dev) {
if (entry->msi_index == nr)
return entry->irq;
}
WARN_ON_ONCE(1);
return -EINVAL;
}
if (dev->msi_enabled) {
struct msi_desc *entry = first_pci_msi_entry(dev);
if (WARN_ON_ONCE(nr >= entry->nvec_used)) if (!dev->msi_enabled && !dev->msix_enabled)
return -EINVAL; return !nr ? dev->irq : -EINVAL;
} else {
if (WARN_ON_ONCE(nr > 0))
return -EINVAL;
}
return dev->irq + nr; irq = msi_get_virq(&dev->dev, nr);
return irq ? irq : -EINVAL;
} }
EXPORT_SYMBOL(pci_irq_vector); EXPORT_SYMBOL(pci_irq_vector);
......
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