Commit e44daade authored by Jon Mason's avatar Jon Mason Committed by David S. Miller

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: default avatarJon Mason <jdmason@kudzu.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d3aa0cb4
...@@ -659,7 +659,6 @@ struct rtl8169_private { ...@@ -659,7 +659,6 @@ struct rtl8169_private {
unsigned int (*phy_reset_pending)(struct rtl8169_private *tp); unsigned int (*phy_reset_pending)(struct rtl8169_private *tp);
unsigned int (*link_ok)(void __iomem *); unsigned int (*link_ok)(void __iomem *);
int (*do_ioctl)(struct rtl8169_private *tp, struct mii_ioctl_data *data, int cmd); int (*do_ioctl)(struct rtl8169_private *tp, struct mii_ioctl_data *data, int cmd);
int pcie_cap;
struct delayed_work task; struct delayed_work task;
unsigned features; unsigned features;
...@@ -3444,9 +3443,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -3444,9 +3443,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
tp->mmio_addr = ioaddr; tp->mmio_addr = ioaddr;
tp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); if (!pci_is_pcie(pdev))
if (!tp->pcie_cap) netif_info(tp, probe, dev, "not PCI Express\n");
netif_info(tp, probe, dev, "no PCI Express capability\n");
RTL_W16(IntrMask, 0x0000); RTL_W16(IntrMask, 0x0000);
...@@ -3898,9 +3896,7 @@ static void rtl_hw_start_8169(struct net_device *dev) ...@@ -3898,9 +3896,7 @@ static void rtl_hw_start_8169(struct net_device *dev)
static void rtl_tx_performance_tweak(struct pci_dev *pdev, u16 force) static void rtl_tx_performance_tweak(struct pci_dev *pdev, u16 force)
{ {
struct net_device *dev = pci_get_drvdata(pdev); int cap = pci_pcie_cap(pdev);
struct rtl8169_private *tp = netdev_priv(dev);
int cap = tp->pcie_cap;
if (cap) { if (cap) {
u16 ctl; u16 ctl;
...@@ -3948,9 +3944,7 @@ static void rtl_ephy_init(void __iomem *ioaddr, const struct ephy_info *e, int l ...@@ -3948,9 +3944,7 @@ static void rtl_ephy_init(void __iomem *ioaddr, const struct ephy_info *e, int l
static void rtl_disable_clock_request(struct pci_dev *pdev) static void rtl_disable_clock_request(struct pci_dev *pdev)
{ {
struct net_device *dev = pci_get_drvdata(pdev); int cap = pci_pcie_cap(pdev);
struct rtl8169_private *tp = netdev_priv(dev);
int cap = tp->pcie_cap;
if (cap) { if (cap) {
u16 ctl; u16 ctl;
...@@ -3963,9 +3957,7 @@ static void rtl_disable_clock_request(struct pci_dev *pdev) ...@@ -3963,9 +3957,7 @@ static void rtl_disable_clock_request(struct pci_dev *pdev)
static void rtl_enable_clock_request(struct pci_dev *pdev) static void rtl_enable_clock_request(struct pci_dev *pdev)
{ {
struct net_device *dev = pci_get_drvdata(pdev); int cap = pci_pcie_cap(pdev);
struct rtl8169_private *tp = netdev_priv(dev);
int cap = tp->pcie_cap;
if (cap) { if (cap) {
u16 ctl; u16 ctl;
...@@ -4395,7 +4387,7 @@ static void rtl_hw_start_8101(struct net_device *dev) ...@@ -4395,7 +4387,7 @@ static void rtl_hw_start_8101(struct net_device *dev)
if (tp->mac_version == RTL_GIGA_MAC_VER_13 || if (tp->mac_version == RTL_GIGA_MAC_VER_13 ||
tp->mac_version == RTL_GIGA_MAC_VER_16) { tp->mac_version == RTL_GIGA_MAC_VER_16) {
int cap = tp->pcie_cap; int cap = pci_pcie_cap(pdev);
if (cap) { if (cap) {
pci_write_config_word(pdev, cap + PCI_EXP_DEVCTL, pci_write_config_word(pdev, cap + PCI_EXP_DEVCTL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment