PCI: Switch msix_program_entries() to use pci_msix_desc_addr()
authorChristoph Hellwig <hch@lst.de>
Tue, 12 Jul 2016 09:20:15 +0000 (18:20 +0900)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 21 Jul 2016 20:49:33 +0000 (15:49 -0500)
Instead of relying on the msix_entry structure for the vector number, read
it from the msi_desc.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Alexander Gordeev <agordeev@redhat.com>
drivers/pci/msi.c

index 0d94fbf95ba6e831a2641224bb38111b2284693b..a385f39be6f7d1a0aa7333abccf7997d1e7d63c5 100644 (file)
@@ -713,11 +713,9 @@ static void msix_program_entries(struct pci_dev *dev,
        int i = 0;
 
        for_each_pci_msi_entry(entry, dev) {
-               int offset = entries[i].entry * PCI_MSIX_ENTRY_SIZE +
-                                               PCI_MSIX_ENTRY_VECTOR_CTRL;
-
                entries[i].vector = entry->irq;
-               entry->masked = readl(entry->mask_base + offset);
+               entry->masked = readl(pci_msix_desc_addr(entry) +
+                               PCI_MSIX_ENTRY_VECTOR_CTRL);
                msix_mask_irq(entry, 1);
                i++;
        }