IB/qib: Clean up unnecessary MSI/MSI-X capability find
authorYijing Wang <wangyijing@huawei.com>
Thu, 8 Aug 2013 13:11:56 +0000 (21:11 +0800)
committerRoland Dreier <roland@purestorage.com>
Tue, 13 Aug 2013 18:17:23 +0000 (11:17 -0700)
PCI core will initialize device MSI/MSI-X capability in
pci_msi_init_pci_dev().  So device drivers should use
pci_dev->msi_cap/msix_cap to determine whether a device supports
MSI/MSI-X instead of using pci_find_capability(pci_dev,
PCI_CAP_ID_MSI/MSIX).  Access to PCIe device config space again will
consume more time.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Acked-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/qib/qib_pcie.c

index c574ec7c85e6834662a78912dafc5bdd2a216a58..3f14009fb6625bb90f3adb94bbf72cd782d61e4f 100644 (file)
@@ -283,12 +283,12 @@ int qib_pcie_params(struct qib_devdata *dd, u32 minw, u32 *nent,
                goto bail;
        }
 
-       pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSIX);
+       pos = dd->pcidev->msix_cap;
        if (nent && *nent && pos) {
                qib_msix_setup(dd, pos, nent, entry);
                ret = 0; /* did it, either MSIx or INTx */
        } else {
-               pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI);
+               pos = dd->pcidev->msi_cap;
                if (pos)
                        ret = qib_msi_setup(dd, pos);
                else
@@ -357,7 +357,7 @@ int qib_reinit_intr(struct qib_devdata *dd)
        if (!dd->msi_lo)
                goto bail;
 
-       pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI);
+       pos = dd->pcidev->msi_cap;
        if (!pos) {
                qib_dev_err(dd,
                        "Can't find MSI capability, can't restore MSI settings\n");
@@ -426,7 +426,7 @@ void qib_enable_intx(struct pci_dev *pdev)
        if (new != cw)
                pci_write_config_word(pdev, PCI_COMMAND, new);
 
-       pos = pci_find_capability(pdev, PCI_CAP_ID_MSI);
+       pos = pdev->msi_cap;
        if (pos) {
                /* then turn off MSI */
                pci_read_config_word(pdev, pos + PCI_MSI_FLAGS, &cw);
@@ -434,7 +434,7 @@ void qib_enable_intx(struct pci_dev *pdev)
                if (new != cw)
                        pci_write_config_word(pdev, pos + PCI_MSI_FLAGS, new);
        }
-       pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
+       pos = pdev->msix_cap;
        if (pos) {
                /* then turn off MSIx */
                pci_read_config_word(pdev, pos + PCI_MSIX_FLAGS, &cw);
This page took 0.025356 seconds and 5 git commands to generate.