summaryrefslogtreecommitdiff
path: root/drivers/pci/msi/legacy.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2021-12-06 23:51:18 +0100
committerThomas Gleixner <tglx@linutronix.de>2021-12-16 22:22:18 +0100
commitae24e28fef14687a26f98050e64153b8e4fee7c7 (patch)
tree3a0b72723febf6da23b97c369ac46a42f57b7952 /drivers/pci/msi/legacy.c
parent9fb9eb4b59acc607e978288c96ac7efa917153d4 (diff)
downloadlwn-ae24e28fef14687a26f98050e64153b8e4fee7c7.tar.gz
lwn-ae24e28fef14687a26f98050e64153b8e4fee7c7.zip
PCI/MSI: Use msi_on_each_desc()
Use the new iterator functions which pave the way for dynamically extending MSI-X vectors. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Michael Kelley <mikelley@microsoft.com> Tested-by: Nishanth Menon <nm@ti.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://lore.kernel.org/r/20211206210748.142603657@linutronix.de
Diffstat (limited to 'drivers/pci/msi/legacy.c')
-rw-r--r--drivers/pci/msi/legacy.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/pci/msi/legacy.c b/drivers/pci/msi/legacy.c
index 91c20a30a5df..cdbb4689db78 100644
--- a/drivers/pci/msi/legacy.c
+++ b/drivers/pci/msi/legacy.c
@@ -28,7 +28,7 @@ int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
if (type == PCI_CAP_ID_MSI && nvec > 1)
return 1;
- for_each_pci_msi_entry(desc, dev) {
+ msi_for_each_desc(desc, &dev->dev, MSI_DESC_NOTASSOCIATED) {
ret = arch_setup_msi_irq(dev, desc);
if (ret)
return ret < 0 ? ret : -ENOSPC;
@@ -42,27 +42,24 @@ void __weak arch_teardown_msi_irqs(struct pci_dev *dev)
struct msi_desc *desc;
int i;
- for_each_pci_msi_entry(desc, dev) {
- if (desc->irq) {
- for (i = 0; i < desc->nvec_used; i++)
- arch_teardown_msi_irq(desc->irq + i);
- }
+ msi_for_each_desc(desc, &dev->dev, MSI_DESC_ASSOCIATED) {
+ for (i = 0; i < desc->nvec_used; i++)
+ arch_teardown_msi_irq(desc->irq + i);
}
}
static int pci_msi_setup_check_result(struct pci_dev *dev, int type, int ret)
{
- struct msi_desc *entry;
+ struct msi_desc *desc;
int avail = 0;
if (type != PCI_CAP_ID_MSIX || ret >= 0)
return ret;
/* Scan the MSI descriptors for successfully allocated ones. */
- for_each_pci_msi_entry(entry, dev) {
- if (entry->irq != 0)
- avail++;
- }
+ msi_for_each_desc(desc, &dev->dev, MSI_DESC_ASSOCIATED)
+ avail++;
+
return avail ? avail : ret;
}