Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b29b0763 authored by Yijing Wang's avatar Yijing Wang Committed by Roland Dreier
Browse files

IB/qib: Clean up unnecessary MSI/MSI-X capability find



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: default avatarYijing Wang <wangyijing@huawei.com>
Acked-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent bea25e82
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -283,12 +283,12 @@ int qib_pcie_params(struct qib_devdata *dd, u32 minw, u32 *nent,
		goto bail;
		goto bail;
	}
	}


	pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSIX);
	pos = dd->pcidev->msix_cap;
	if (nent && *nent && pos) {
	if (nent && *nent && pos) {
		qib_msix_setup(dd, pos, nent, entry);
		qib_msix_setup(dd, pos, nent, entry);
		ret = 0; /* did it, either MSIx or INTx */
		ret = 0; /* did it, either MSIx or INTx */
	} else {
	} else {
		pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI);
		pos = dd->pcidev->msi_cap;
		if (pos)
		if (pos)
			ret = qib_msi_setup(dd, pos);
			ret = qib_msi_setup(dd, pos);
		else
		else
@@ -357,7 +357,7 @@ int qib_reinit_intr(struct qib_devdata *dd)
	if (!dd->msi_lo)
	if (!dd->msi_lo)
		goto bail;
		goto bail;


	pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI);
	pos = dd->pcidev->msi_cap;
	if (!pos) {
	if (!pos) {
		qib_dev_err(dd,
		qib_dev_err(dd,
			"Can't find MSI capability, can't restore MSI settings\n");
			"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)
	if (new != cw)
		pci_write_config_word(pdev, PCI_COMMAND, new);
		pci_write_config_word(pdev, PCI_COMMAND, new);


	pos = pci_find_capability(pdev, PCI_CAP_ID_MSI);
	pos = pdev->msi_cap;
	if (pos) {
	if (pos) {
		/* then turn off MSI */
		/* then turn off MSI */
		pci_read_config_word(pdev, pos + PCI_MSI_FLAGS, &cw);
		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)
		if (new != cw)
			pci_write_config_word(pdev, pos + PCI_MSI_FLAGS, new);
			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) {
	if (pos) {
		/* then turn off MSIx */
		/* then turn off MSIx */
		pci_read_config_word(pdev, pos + PCI_MSIX_FLAGS, &cw);
		pci_read_config_word(pdev, pos + PCI_MSIX_FLAGS, &cw);