mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-14 12:37:32 +00:00
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>
This commit is contained in:
parent
e82760e7d6
commit
77c98e6a7a
2 changed files with 4 additions and 7 deletions
|
@ -1156,7 +1156,6 @@ struct bnx2x {
|
||||||
#define NO_FCOE(bp) ((bp)->flags & NO_FCOE_FLAG)
|
#define NO_FCOE(bp) ((bp)->flags & NO_FCOE_FLAG)
|
||||||
|
|
||||||
int pm_cap;
|
int pm_cap;
|
||||||
int pcie_cap;
|
|
||||||
int mrrs;
|
int mrrs;
|
||||||
|
|
||||||
struct delayed_work sp_task;
|
struct delayed_work sp_task;
|
||||||
|
|
|
@ -1222,7 +1222,7 @@ static inline u8 bnx2x_is_pcie_pending(struct pci_dev *dev)
|
||||||
int pos;
|
int pos;
|
||||||
u16 status;
|
u16 status;
|
||||||
|
|
||||||
pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
|
pos = pci_pcie_cap(dev);
|
||||||
if (!pos)
|
if (!pos)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -5498,7 +5498,7 @@ static void bnx2x_init_pxp(struct bnx2x *bp)
|
||||||
int r_order, w_order;
|
int r_order, w_order;
|
||||||
|
|
||||||
pci_read_config_word(bp->pdev,
|
pci_read_config_word(bp->pdev,
|
||||||
bp->pcie_cap + PCI_EXP_DEVCTL, &devctl);
|
bp->pdev->pcie_cap + PCI_EXP_DEVCTL, &devctl);
|
||||||
DP(NETIF_MSG_HW, "read 0x%x from devctl\n", devctl);
|
DP(NETIF_MSG_HW, "read 0x%x from devctl\n", devctl);
|
||||||
w_order = ((devctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5);
|
w_order = ((devctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5);
|
||||||
if (bp->mrrs == -1)
|
if (bp->mrrs == -1)
|
||||||
|
@ -9759,10 +9759,8 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
|
||||||
goto err_out_release;
|
goto err_out_release;
|
||||||
}
|
}
|
||||||
|
|
||||||
bp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
|
if (!pci_is_pcie(pdev)) {
|
||||||
if (bp->pcie_cap == 0) {
|
dev_err(&bp->pdev->dev, "Not PCI Express, aborting\n");
|
||||||
dev_err(&bp->pdev->dev,
|
|
||||||
"Cannot find PCI Express capability, aborting\n");
|
|
||||||
rc = -EIO;
|
rc = -EIO;
|
||||||
goto err_out_release;
|
goto err_out_release;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue