浏览代码

IB/qib: Remove unnecessary read of PCI_CAP_ID_EXP

The PCIE capability offset is saved during PCI bus walking.  It will
remove an unnecessary search in the PCI configuration space if this
value is referenced instead of reacquiring it.

Signed-off-by: Jon Mason <jdmason@kudzu.us>
Acked-by: Mike Marciniszyn <mike.marciniszyn@qlogic.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Jon Mason 14 年之前
父节点
当前提交
7f27cda037
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      drivers/infiniband/hw/qib/qib_pcie.c

+ 4 - 4
drivers/infiniband/hw/qib/qib_pcie.c

@@ -255,7 +255,7 @@ int qib_pcie_params(struct qib_devdata *dd, u32 minw, u32 *nent,
 	u16 linkstat, speed;
 	u16 linkstat, speed;
 	int pos = 0, pose, ret = 1;
 	int pos = 0, pose, ret = 1;
 
 
-	pose = pci_find_capability(dd->pcidev, PCI_CAP_ID_EXP);
+	pose = pci_pcie_cap(dd->pcidev);
 	if (!pose) {
 	if (!pose) {
 		qib_dev_err(dd, "Can't find PCI Express capability!\n");
 		qib_dev_err(dd, "Can't find PCI Express capability!\n");
 		/* set up something... */
 		/* set up something... */
@@ -509,7 +509,7 @@ static int qib_tune_pcie_coalesce(struct qib_devdata *dd)
 		qib_devinfo(dd->pcidev, "Parent not root\n");
 		qib_devinfo(dd->pcidev, "Parent not root\n");
 		return 1;
 		return 1;
 	}
 	}
-	ppos = pci_find_capability(parent, PCI_CAP_ID_EXP);
+	ppos = pci_pcie_cap(parent);
 	if (!ppos)
 	if (!ppos)
 		return 1;
 		return 1;
 	if (parent->vendor != 0x8086)
 	if (parent->vendor != 0x8086)
@@ -578,14 +578,14 @@ static int qib_tune_pcie_caps(struct qib_devdata *dd)
 		qib_devinfo(dd->pcidev, "Parent not root\n");
 		qib_devinfo(dd->pcidev, "Parent not root\n");
 		goto bail;
 		goto bail;
 	}
 	}
-	ppos = pci_find_capability(parent, PCI_CAP_ID_EXP);
+	ppos = pci_pcie_cap(parent);
 	if (ppos) {
 	if (ppos) {
 		pci_read_config_word(parent, ppos + PCI_EXP_DEVCAP, &pcaps);
 		pci_read_config_word(parent, ppos + PCI_EXP_DEVCAP, &pcaps);
 		pci_read_config_word(parent, ppos + PCI_EXP_DEVCTL, &pctl);
 		pci_read_config_word(parent, ppos + PCI_EXP_DEVCTL, &pctl);
 	} else
 	} else
 		goto bail;
 		goto bail;
 	/* Find out supported and configured values for endpoint (us) */
 	/* Find out supported and configured values for endpoint (us) */
-	epos = pci_find_capability(dd->pcidev, PCI_CAP_ID_EXP);
+	epos = pci_pcie_cap(dd->pcidev);
 	if (epos) {
 	if (epos) {
 		pci_read_config_word(dd->pcidev, epos + PCI_EXP_DEVCAP, &ecaps);
 		pci_read_config_word(dd->pcidev, epos + PCI_EXP_DEVCAP, &ecaps);
 		pci_read_config_word(dd->pcidev, epos + PCI_EXP_DEVCTL, &ectl);
 		pci_read_config_word(dd->pcidev, epos + PCI_EXP_DEVCTL, &ectl);