summaryrefslogtreecommitdiff
path: root/drivers/pci/msi
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2021-12-10 23:19:25 +0100
committerThomas Gleixner <tglx@linutronix.de>2021-12-16 22:16:41 +0100
commit82ff8e6b78fc4587a4255301f0a283506daf11b6 (patch)
tree0e604e370fc5fa3c986e373c03a6d8b62aa4a5d5 /drivers/pci/msi
parentcf15f43acaad31dabb2646cef170a506a1d663eb (diff)
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: Thomas Gleixner <tglx@linutronix.de> Tested-by: Michael Kelley <mikelley@microsoft.com> Tested-by: Nishanth Menon <nm@ti.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20211210221814.841243231@linutronix.de
Diffstat (limited to 'drivers/pci/msi')
-rw-r--r--drivers/pci/msi/msi.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
index 8fb4dd2a18b9..fad387363033 100644
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -1080,28 +1080,13 @@ EXPORT_SYMBOL(pci_free_irq_vectors);
*/
int pci_irq_vector(struct pci_dev *dev, unsigned int nr)
{
- if (dev->msix_enabled) {
- 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;
- }
+ unsigned int irq;
- if (dev->msi_enabled) {
- struct msi_desc *entry = first_pci_msi_entry(dev);
-
- if (WARN_ON_ONCE(nr >= entry->nvec_used))
- return -EINVAL;
- } else {
- if (WARN_ON_ONCE(nr > 0))
- return -EINVAL;
- }
+ if (!dev->msi_enabled && !dev->msix_enabled)
+ return !nr ? dev->irq : -EINVAL;
- return dev->irq + nr;
+ irq = msi_get_virq(&dev->dev, nr);
+ return irq ? irq : -EINVAL;
}
EXPORT_SYMBOL(pci_irq_vector);