]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bnx2x: remove unnecessary read of PCI_CAP_ID_EXP
authorJon Mason <jdmason@kudzu.us>
Mon, 27 Jun 2011 07:45:12 +0000 (07:45 +0000)
committerJoe Jin <joe.jin@oracle.com>
Wed, 16 May 2012 07:21:07 +0000 (15:21 +0800)
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).

(cherry picked from commit 77c98e6a7a3ab76340b315d31fe1edded17cba15)
Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
drivers/net/bnx2x/bnx2x.h
drivers/net/bnx2x/bnx2x_main.c

index 05e29368dc7a15a4e92723a2c0b7dbc5037027c1..3e02744874399fbd959e02c00a1e4277347402ac 100644 (file)
@@ -1155,7 +1155,6 @@ struct bnx2x {
 #define NO_FCOE(bp)            ((bp)->flags & NO_FCOE_FLAG)
 
        int                     pm_cap;
-       int                     pcie_cap;
        int                     mrrs;
 
        struct delayed_work     sp_task;
index 6758f849adb62003c08236f228613383646a0f47..472b1195d57c934441d57386cdec08b9bac5d1bf 100644 (file)
@@ -1223,7 +1223,7 @@ static inline u8 bnx2x_is_pcie_pending(struct pci_dev *dev)
        int pos;
        u16 status;
 
-       pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
+       pos = pci_pcie_cap(dev);
        if (!pos)
                return false;
 
@@ -5500,7 +5500,7 @@ static void bnx2x_init_pxp(struct bnx2x *bp)
        int r_order, w_order;
 
        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);
        w_order = ((devctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5);
        if (bp->mrrs == -1)
@@ -9815,10 +9815,8 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
                goto err_out_release;
        }
 
-       bp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
-       if (bp->pcie_cap == 0) {
-               dev_err(&bp->pdev->dev,
-                       "Cannot find PCI Express capability, aborting\n");
+       if (!pci_is_pcie(pdev)) {
+               dev_err(&bp->pdev->dev, "Not PCI Express, aborting\n");
                rc = -EIO;
                goto err_out_release;
        }