aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Mason <mason@myri.com>2011-06-27 01:05:05 -0400
committerDavid S. Miller <davem@davemloft.net>2011-06-29 09:02:05 -0400
commiteffd1edab9fd3dc03cb87097a9da2552b940456b (patch)
treec290998d4b836ca0dd2f79e8d213e97866aeb5eb
parent5dcd846712046d68020e9dfddd7ca491dc138f0d (diff)
myri10ge: 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. Signed-off-by: Jon Mason <mason@myri.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/myri10ge/myri10ge.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index a0d4c619e859..42ea4f809171 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1081,7 +1081,7 @@ static int myri10ge_toggle_relaxed(struct pci_dev *pdev, int on)
1081 int ret, cap, err; 1081 int ret, cap, err;
1082 u16 ctl; 1082 u16 ctl;
1083 1083
1084 cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); 1084 cap = pci_pcie_cap(pdev);
1085 if (!cap) 1085 if (!cap)
1086 return 0; 1086 return 0;
1087 1087
@@ -3191,7 +3191,7 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp)
3191{ 3191{
3192 struct pci_dev *bridge = mgp->pdev->bus->self; 3192 struct pci_dev *bridge = mgp->pdev->bus->self;
3193 struct device *dev = &mgp->pdev->dev; 3193 struct device *dev = &mgp->pdev->dev;
3194 unsigned cap; 3194 int cap;
3195 unsigned err_cap; 3195 unsigned err_cap;
3196 u16 val; 3196 u16 val;
3197 u8 ext_type; 3197 u8 ext_type;
@@ -3201,7 +3201,7 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp)
3201 return; 3201 return;
3202 3202
3203 /* check that the bridge is a root port */ 3203 /* check that the bridge is a root port */
3204 cap = pci_find_capability(bridge, PCI_CAP_ID_EXP); 3204 cap = pci_pcie_cap(bridge);
3205 pci_read_config_word(bridge, cap + PCI_CAP_FLAGS, &val); 3205 pci_read_config_word(bridge, cap + PCI_CAP_FLAGS, &val);
3206 ext_type = (val & PCI_EXP_FLAGS_TYPE) >> 4; 3206 ext_type = (val & PCI_EXP_FLAGS_TYPE) >> 4;
3207 if (ext_type != PCI_EXP_TYPE_ROOT_PORT) { 3207 if (ext_type != PCI_EXP_TYPE_ROOT_PORT) {
@@ -3219,8 +3219,7 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp)
3219 " to force ECRC\n"); 3219 " to force ECRC\n");
3220 return; 3220 return;
3221 } 3221 }
3222 cap = 3222 cap = pci_pcie_cap(bridge);
3223 pci_find_capability(bridge, PCI_CAP_ID_EXP);
3224 pci_read_config_word(bridge, 3223 pci_read_config_word(bridge,
3225 cap + PCI_CAP_FLAGS, &val); 3224 cap + PCI_CAP_FLAGS, &val);
3226 ext_type = (val & PCI_EXP_FLAGS_TYPE) >> 4; 3225 ext_type = (val & PCI_EXP_FLAGS_TYPE) >> 4;
@@ -3341,7 +3340,7 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
3341 int link_width, exp_cap; 3340 int link_width, exp_cap;
3342 u16 lnk; 3341 u16 lnk;
3343 3342
3344 exp_cap = pci_find_capability(mgp->pdev, PCI_CAP_ID_EXP); 3343 exp_cap = pci_pcie_cap(mgp->pdev);
3345 pci_read_config_word(mgp->pdev, exp_cap + PCI_EXP_LNKSTA, &lnk); 3344 pci_read_config_word(mgp->pdev, exp_cap + PCI_EXP_LNKSTA, &lnk);
3346 link_width = (lnk >> 4) & 0x3f; 3345 link_width = (lnk >> 4) & 0x3f;
3347 3346