diff options
author | Jon Mason <jdmason@kudzu.us> | 2011-06-27 03:45:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-28 00:40:45 -0400 |
commit | 77c98e6a7a3ab76340b315d31fe1edded17cba15 (patch) | |
tree | 7f73bdbdb03e2740b1250ac05486abf98d0459a8 /drivers/net/bnx2x/bnx2x_main.c | |
parent | e82760e7d6498d24d1a92f22767ba578c8980a6d (diff) |
bnx2x: 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. Also, pci_is_pcie is a
better way of determining if the device is PCIE or not (as it uses the
same saved PCIE capability offset).
Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_main.c')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_main.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c index af5721754f65..b6f82ebc30aa 100644 --- a/drivers/net/bnx2x/bnx2x_main.c +++ b/drivers/net/bnx2x/bnx2x_main.c | |||
@@ -1222,7 +1222,7 @@ static inline u8 bnx2x_is_pcie_pending(struct pci_dev *dev) | |||
1222 | int pos; | 1222 | int pos; |
1223 | u16 status; | 1223 | u16 status; |
1224 | 1224 | ||
1225 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); | 1225 | pos = pci_pcie_cap(dev); |
1226 | if (!pos) | 1226 | if (!pos) |
1227 | return false; | 1227 | return false; |
1228 | 1228 | ||
@@ -5498,7 +5498,7 @@ static void bnx2x_init_pxp(struct bnx2x *bp) | |||
5498 | int r_order, w_order; | 5498 | int r_order, w_order; |
5499 | 5499 | ||
5500 | pci_read_config_word(bp->pdev, | 5500 | pci_read_config_word(bp->pdev, |
5501 | bp->pcie_cap + PCI_EXP_DEVCTL, &devctl); | 5501 | bp->pdev->pcie_cap + PCI_EXP_DEVCTL, &devctl); |
5502 | DP(NETIF_MSG_HW, "read 0x%x from devctl\n", devctl); | 5502 | DP(NETIF_MSG_HW, "read 0x%x from devctl\n", devctl); |
5503 | w_order = ((devctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5); | 5503 | w_order = ((devctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5); |
5504 | if (bp->mrrs == -1) | 5504 | if (bp->mrrs == -1) |
@@ -9759,10 +9759,8 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, | |||
9759 | goto err_out_release; | 9759 | goto err_out_release; |
9760 | } | 9760 | } |
9761 | 9761 | ||
9762 | bp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 9762 | if (!pci_is_pcie(pdev)) { |
9763 | if (bp->pcie_cap == 0) { | 9763 | dev_err(&bp->pdev->dev, "Not PCI Express, aborting\n"); |
9764 | dev_err(&bp->pdev->dev, | ||
9765 | "Cannot find PCI Express capability, aborting\n"); | ||
9766 | rc = -EIO; | 9764 | rc = -EIO; |
9767 | goto err_out_release; | 9765 | goto err_out_release; |
9768 | } | 9766 | } |