diff options
author | Jon Mason <jdmason@kudzu.us> | 2011-06-27 03:46:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-28 00:40:45 -0400 |
commit | e44daaded19baf8b7cf9ab3dedad8a01b8c49251 (patch) | |
tree | d7efeb7a2737e20a666ef03f7905cc8fe47d00a6 /drivers/net/r8169.c | |
parent | d3aa0cb44f2cfcdfa6df1bd40b9c182b35528849 (diff) |
r8169: remove unnecessary read of PCI_CAP_ID_EXP
The PCIE capability offset is saved during PCI bus walking. Use the
value from pci_dev instead of checking in the driver and saving it off
the the driver specific structure. Also, 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 <jdmason@kudzu.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r-- | drivers/net/r8169.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index f8c4435afe51..fbd68383ca60 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -659,7 +659,6 @@ struct rtl8169_private { | |||
659 | unsigned int (*phy_reset_pending)(struct rtl8169_private *tp); | 659 | unsigned int (*phy_reset_pending)(struct rtl8169_private *tp); |
660 | unsigned int (*link_ok)(void __iomem *); | 660 | unsigned int (*link_ok)(void __iomem *); |
661 | int (*do_ioctl)(struct rtl8169_private *tp, struct mii_ioctl_data *data, int cmd); | 661 | int (*do_ioctl)(struct rtl8169_private *tp, struct mii_ioctl_data *data, int cmd); |
662 | int pcie_cap; | ||
663 | struct delayed_work task; | 662 | struct delayed_work task; |
664 | unsigned features; | 663 | unsigned features; |
665 | 664 | ||
@@ -3444,9 +3443,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3444 | } | 3443 | } |
3445 | tp->mmio_addr = ioaddr; | 3444 | tp->mmio_addr = ioaddr; |
3446 | 3445 | ||
3447 | tp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 3446 | if (!pci_is_pcie(pdev)) |
3448 | if (!tp->pcie_cap) | 3447 | netif_info(tp, probe, dev, "not PCI Express\n"); |
3449 | netif_info(tp, probe, dev, "no PCI Express capability\n"); | ||
3450 | 3448 | ||
3451 | RTL_W16(IntrMask, 0x0000); | 3449 | RTL_W16(IntrMask, 0x0000); |
3452 | 3450 | ||
@@ -3898,9 +3896,7 @@ static void rtl_hw_start_8169(struct net_device *dev) | |||
3898 | 3896 | ||
3899 | static void rtl_tx_performance_tweak(struct pci_dev *pdev, u16 force) | 3897 | static void rtl_tx_performance_tweak(struct pci_dev *pdev, u16 force) |
3900 | { | 3898 | { |
3901 | struct net_device *dev = pci_get_drvdata(pdev); | 3899 | int cap = pci_pcie_cap(pdev); |
3902 | struct rtl8169_private *tp = netdev_priv(dev); | ||
3903 | int cap = tp->pcie_cap; | ||
3904 | 3900 | ||
3905 | if (cap) { | 3901 | if (cap) { |
3906 | u16 ctl; | 3902 | u16 ctl; |
@@ -3948,9 +3944,7 @@ static void rtl_ephy_init(void __iomem *ioaddr, const struct ephy_info *e, int l | |||
3948 | 3944 | ||
3949 | static void rtl_disable_clock_request(struct pci_dev *pdev) | 3945 | static void rtl_disable_clock_request(struct pci_dev *pdev) |
3950 | { | 3946 | { |
3951 | struct net_device *dev = pci_get_drvdata(pdev); | 3947 | int cap = pci_pcie_cap(pdev); |
3952 | struct rtl8169_private *tp = netdev_priv(dev); | ||
3953 | int cap = tp->pcie_cap; | ||
3954 | 3948 | ||
3955 | if (cap) { | 3949 | if (cap) { |
3956 | u16 ctl; | 3950 | u16 ctl; |
@@ -3963,9 +3957,7 @@ static void rtl_disable_clock_request(struct pci_dev *pdev) | |||
3963 | 3957 | ||
3964 | static void rtl_enable_clock_request(struct pci_dev *pdev) | 3958 | static void rtl_enable_clock_request(struct pci_dev *pdev) |
3965 | { | 3959 | { |
3966 | struct net_device *dev = pci_get_drvdata(pdev); | 3960 | int cap = pci_pcie_cap(pdev); |
3967 | struct rtl8169_private *tp = netdev_priv(dev); | ||
3968 | int cap = tp->pcie_cap; | ||
3969 | 3961 | ||
3970 | if (cap) { | 3962 | if (cap) { |
3971 | u16 ctl; | 3963 | u16 ctl; |
@@ -4395,7 +4387,7 @@ static void rtl_hw_start_8101(struct net_device *dev) | |||
4395 | 4387 | ||
4396 | if (tp->mac_version == RTL_GIGA_MAC_VER_13 || | 4388 | if (tp->mac_version == RTL_GIGA_MAC_VER_13 || |
4397 | tp->mac_version == RTL_GIGA_MAC_VER_16) { | 4389 | tp->mac_version == RTL_GIGA_MAC_VER_16) { |
4398 | int cap = tp->pcie_cap; | 4390 | int cap = pci_pcie_cap(pdev); |
4399 | 4391 | ||
4400 | if (cap) { | 4392 | if (cap) { |
4401 | pci_write_config_word(pdev, cap + PCI_EXP_DEVCTL, | 4393 | pci_write_config_word(pdev, cap + PCI_EXP_DEVCTL, |