Commit ec2f204b authored by Heiner Kallweit's avatar Heiner Kallweit Committed by David S. Miller

r8169: remove no longer needed checks for device being runtime-active

Because the netdevice is marked as detached now when parent is not
accessible we can remove quite some checks.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 476c4f5d
...@@ -1422,24 +1422,17 @@ static void __rtl8169_set_wol(struct rtl8169_private *tp, u32 wolopts) ...@@ -1422,24 +1422,17 @@ static void __rtl8169_set_wol(struct rtl8169_private *tp, u32 wolopts)
static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{ {
struct rtl8169_private *tp = netdev_priv(dev); struct rtl8169_private *tp = netdev_priv(dev);
struct device *d = tp_to_dev(tp);
if (wol->wolopts & ~WAKE_ANY) if (wol->wolopts & ~WAKE_ANY)
return -EINVAL; return -EINVAL;
pm_runtime_get_noresume(d);
rtl_lock_work(tp); rtl_lock_work(tp);
tp->saved_wolopts = wol->wolopts; tp->saved_wolopts = wol->wolopts;
__rtl8169_set_wol(tp, tp->saved_wolopts);
if (pm_runtime_active(d))
__rtl8169_set_wol(tp, tp->saved_wolopts);
rtl_unlock_work(tp); rtl_unlock_work(tp);
pm_runtime_put_noidle(d);
return 0; return 0;
} }
...@@ -1657,17 +1650,10 @@ static void rtl8169_get_ethtool_stats(struct net_device *dev, ...@@ -1657,17 +1650,10 @@ static void rtl8169_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *data) struct ethtool_stats *stats, u64 *data)
{ {
struct rtl8169_private *tp = netdev_priv(dev); struct rtl8169_private *tp = netdev_priv(dev);
struct device *d = tp_to_dev(tp); struct rtl8169_counters *counters;
struct rtl8169_counters *counters = tp->counters;
ASSERT_RTNL();
pm_runtime_get_noresume(d);
if (pm_runtime_active(d))
rtl8169_update_counters(tp);
pm_runtime_put_noidle(d); counters = tp->counters;
rtl8169_update_counters(tp);
data[0] = le64_to_cpu(counters->tx_packets); data[0] = le64_to_cpu(counters->tx_packets);
data[1] = le64_to_cpu(counters->rx_packets); data[1] = le64_to_cpu(counters->rx_packets);
...@@ -1899,48 +1885,26 @@ static int rtl_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) ...@@ -1899,48 +1885,26 @@ static int rtl_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec)
static int rtl8169_get_eee(struct net_device *dev, struct ethtool_eee *data) static int rtl8169_get_eee(struct net_device *dev, struct ethtool_eee *data)
{ {
struct rtl8169_private *tp = netdev_priv(dev); struct rtl8169_private *tp = netdev_priv(dev);
struct device *d = tp_to_dev(tp);
int ret;
if (!rtl_supports_eee(tp)) if (!rtl_supports_eee(tp))
return -EOPNOTSUPP; return -EOPNOTSUPP;
pm_runtime_get_noresume(d); return phy_ethtool_get_eee(tp->phydev, data);
if (!pm_runtime_active(d)) {
ret = -EOPNOTSUPP;
} else {
ret = phy_ethtool_get_eee(tp->phydev, data);
}
pm_runtime_put_noidle(d);
return ret;
} }
static int rtl8169_set_eee(struct net_device *dev, struct ethtool_eee *data) static int rtl8169_set_eee(struct net_device *dev, struct ethtool_eee *data)
{ {
struct rtl8169_private *tp = netdev_priv(dev); struct rtl8169_private *tp = netdev_priv(dev);
struct device *d = tp_to_dev(tp);
int ret; int ret;
if (!rtl_supports_eee(tp)) if (!rtl_supports_eee(tp))
return -EOPNOTSUPP; return -EOPNOTSUPP;
pm_runtime_get_noresume(d);
if (!pm_runtime_active(d)) {
ret = -EOPNOTSUPP;
goto out;
}
ret = phy_ethtool_set_eee(tp->phydev, data); ret = phy_ethtool_set_eee(tp->phydev, data);
if (!ret) if (!ret)
tp->eee_adv = phy_read_mmd(dev->phydev, MDIO_MMD_AN, tp->eee_adv = phy_read_mmd(dev->phydev, MDIO_MMD_AN,
MDIO_AN_EEE_ADV); MDIO_AN_EEE_ADV);
out:
pm_runtime_put_noidle(d);
return ret; return ret;
} }
...@@ -2219,19 +2183,13 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr) ...@@ -2219,19 +2183,13 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
static int rtl_set_mac_address(struct net_device *dev, void *p) static int rtl_set_mac_address(struct net_device *dev, void *p)
{ {
struct rtl8169_private *tp = netdev_priv(dev); struct rtl8169_private *tp = netdev_priv(dev);
struct device *d = tp_to_dev(tp);
int ret; int ret;
ret = eth_mac_addr(dev, p); ret = eth_mac_addr(dev, p);
if (ret) if (ret)
return ret; return ret;
pm_runtime_get_noresume(d); rtl_rar_set(tp, dev->dev_addr);
if (pm_runtime_active(d))
rtl_rar_set(tp, dev->dev_addr);
pm_runtime_put_noidle(d);
return 0; return 0;
} }
......
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