diff options
author | Yijing Wang <wangyijing@huawei.com> | 2013-08-08 09:11:56 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2013-08-13 14:17:23 -0400 |
commit | b29b0763949de035fd9341b70f869bd6f400ea4e (patch) | |
tree | 88c8bdda89f5ba8c424f2978c8178ea0cf60829b | |
parent | bea25e82c61fdf693949178594ee58aced72927d (diff) |
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: Yijing Wang <wangyijing@huawei.com>
Acked-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/infiniband/hw/qib/qib_pcie.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/qib/qib_pcie.c b/drivers/infiniband/hw/qib/qib_pcie.c index c574ec7c85e6..3f14009fb662 100644 --- a/drivers/infiniband/hw/qib/qib_pcie.c +++ b/drivers/infiniband/hw/qib/qib_pcie.c | |||
@@ -283,12 +283,12 @@ int qib_pcie_params(struct qib_devdata *dd, u32 minw, u32 *nent, | |||
283 | goto bail; | 283 | goto bail; |
284 | } | 284 | } |
285 | 285 | ||
286 | pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSIX); | 286 | pos = dd->pcidev->msix_cap; |
287 | if (nent && *nent && pos) { | 287 | if (nent && *nent && pos) { |
288 | qib_msix_setup(dd, pos, nent, entry); | 288 | qib_msix_setup(dd, pos, nent, entry); |
289 | ret = 0; /* did it, either MSIx or INTx */ | 289 | ret = 0; /* did it, either MSIx or INTx */ |
290 | } else { | 290 | } else { |
291 | pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI); | 291 | pos = dd->pcidev->msi_cap; |
292 | if (pos) | 292 | if (pos) |
293 | ret = qib_msi_setup(dd, pos); | 293 | ret = qib_msi_setup(dd, pos); |
294 | else | 294 | else |
@@ -357,7 +357,7 @@ int qib_reinit_intr(struct qib_devdata *dd) | |||
357 | if (!dd->msi_lo) | 357 | if (!dd->msi_lo) |
358 | goto bail; | 358 | goto bail; |
359 | 359 | ||
360 | pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI); | 360 | pos = dd->pcidev->msi_cap; |
361 | if (!pos) { | 361 | if (!pos) { |
362 | qib_dev_err(dd, | 362 | qib_dev_err(dd, |
363 | "Can't find MSI capability, can't restore MSI settings\n"); | 363 | "Can't find MSI capability, can't restore MSI settings\n"); |
@@ -426,7 +426,7 @@ void qib_enable_intx(struct pci_dev *pdev) | |||
426 | if (new != cw) | 426 | if (new != cw) |
427 | pci_write_config_word(pdev, PCI_COMMAND, new); | 427 | pci_write_config_word(pdev, PCI_COMMAND, new); |
428 | 428 | ||
429 | pos = pci_find_capability(pdev, PCI_CAP_ID_MSI); | 429 | pos = pdev->msi_cap; |
430 | if (pos) { | 430 | if (pos) { |
431 | /* then turn off MSI */ | 431 | /* then turn off MSI */ |
432 | pci_read_config_word(pdev, pos + PCI_MSI_FLAGS, &cw); | 432 | pci_read_config_word(pdev, pos + PCI_MSI_FLAGS, &cw); |
@@ -434,7 +434,7 @@ void qib_enable_intx(struct pci_dev *pdev) | |||
434 | if (new != cw) | 434 | if (new != cw) |
435 | pci_write_config_word(pdev, pos + PCI_MSI_FLAGS, new); | 435 | pci_write_config_word(pdev, pos + PCI_MSI_FLAGS, new); |
436 | } | 436 | } |
437 | pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX); | 437 | pos = pdev->msix_cap; |
438 | if (pos) { | 438 | if (pos) { |
439 | /* then turn off MSIx */ | 439 | /* then turn off MSIx */ |
440 | pci_read_config_word(pdev, pos + PCI_MSIX_FLAGS, &cw); | 440 | pci_read_config_word(pdev, pos + PCI_MSIX_FLAGS, &cw); |