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

r8169: remove driver-specific mutex

Now that the critical sections are protected with RTNL lock, we don't
need a separate mutex any longer.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent abe5fc42
......@@ -611,7 +611,6 @@ struct rtl8169_private {
struct {
DECLARE_BITMAP(flags, RTL_FLAG_MAX);
struct mutex mutex;
struct work_struct work;
} wk;
......@@ -663,16 +662,6 @@ static inline struct device *tp_to_dev(struct rtl8169_private *tp)
return &tp->pci_dev->dev;
}
static void rtl_lock_work(struct rtl8169_private *tp)
{
mutex_lock(&tp->wk.mutex);
}
static void rtl_unlock_work(struct rtl8169_private *tp)
{
mutex_unlock(&tp->wk.mutex);
}
static void rtl_lock_config_regs(struct rtl8169_private *tp)
{
RTL_W8(tp, Cfg9346, Cfg9346_Lock);
......@@ -1348,10 +1337,8 @@ static void rtl8169_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
struct rtl8169_private *tp = netdev_priv(dev);
rtl_lock_work(tp);
wol->supported = WAKE_ANY;
wol->wolopts = tp->saved_wolopts;
rtl_unlock_work(tp);
}
static void __rtl8169_set_wol(struct rtl8169_private *tp, u32 wolopts)
......@@ -1426,13 +1413,9 @@ static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
if (wol->wolopts & ~WAKE_ANY)
return -EINVAL;
rtl_lock_work(tp);
tp->saved_wolopts = wol->wolopts;
__rtl8169_set_wol(tp, tp->saved_wolopts);
rtl_unlock_work(tp);
return 0;
}
......@@ -1495,8 +1478,6 @@ static int rtl8169_set_features(struct net_device *dev,
{
struct rtl8169_private *tp = netdev_priv(dev);
rtl_lock_work(tp);
rtl_set_rx_config_features(tp, features);
if (features & NETIF_F_RXCSUM)
......@@ -1514,8 +1495,6 @@ static int rtl8169_set_features(struct net_device *dev,
RTL_W16(tp, CPlusCmd, tp->cp_cmd);
rtl_pci_commit(tp);
rtl_unlock_work(tp);
return 0;
}
......@@ -1541,10 +1520,8 @@ static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,
u32 *dw = p;
int i;
rtl_lock_work(tp);
for (i = 0; i < R8169_REGS_SIZE; i += 4)
memcpy_fromio(dw++, data++, 4);
rtl_unlock_work(tp);
}
static const char rtl8169_gstrings[][ETH_GSTRING_LEN] = {
......@@ -1860,8 +1837,6 @@ static int rtl_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec)
units = DIV_ROUND_UP(ec->rx_coalesce_usecs * 1000U, scale);
w |= FIELD_PREP(RTL_COALESCE_RX_USECS, units);
rtl_lock_work(tp);
RTL_W16(tp, IntrMitigate, w);
/* Meaning of PktCntrDisable bit changed from RTL8168e-vl */
......@@ -1877,8 +1852,6 @@ static int rtl_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec)
RTL_W16(tp, CPlusCmd, tp->cp_cmd);
rtl_pci_commit(tp);
rtl_unlock_work(tp);
return 0;
}
......@@ -2162,8 +2135,6 @@ static void rtl8169_init_phy(struct rtl8169_private *tp)
static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
{
rtl_lock_work(tp);
rtl_unlock_config_regs(tp);
RTL_W32(tp, MAC4, addr[4] | addr[5] << 8);
......@@ -2176,8 +2147,6 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
rtl_rar_exgmac_set(tp, addr);
rtl_lock_config_regs(tp);
rtl_unlock_work(tp);
}
static int rtl_set_mac_address(struct net_device *dev, void *p)
......@@ -4525,7 +4494,6 @@ static void rtl_task(struct work_struct *work)
container_of(work, struct rtl8169_private, wk.work);
rtnl_lock();
rtl_lock_work(tp);
if (!netif_running(tp->dev) ||
!test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags))
......@@ -4536,7 +4504,6 @@ static void rtl_task(struct work_struct *work)
netif_wake_queue(tp->dev);
}
out_unlock:
rtl_unlock_work(tp);
rtnl_unlock();
}
......@@ -4599,8 +4566,6 @@ static int r8169_phy_connect(struct rtl8169_private *tp)
static void rtl8169_down(struct rtl8169_private *tp)
{
rtl_lock_work(tp);
/* Clear all task flags */
bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
......@@ -4611,13 +4576,10 @@ static void rtl8169_down(struct rtl8169_private *tp)
rtl8169_cleanup(tp, true);
rtl_pll_power_down(tp);
rtl_unlock_work(tp);
}
static void rtl8169_up(struct rtl8169_private *tp)
{
rtl_lock_work(tp);
rtl_pll_power_up(tp);
rtl8169_init_phy(tp);
napi_enable(&tp->napi);
......@@ -4625,7 +4587,6 @@ static void rtl8169_up(struct rtl8169_private *tp)
rtl_reset_work(tp);
phy_start(tp->phydev);
rtl_unlock_work(tp);
}
static int rtl8169_close(struct net_device *dev)
......@@ -4821,10 +4782,7 @@ static int rtl8169_runtime_suspend(struct device *device)
}
rtnl_lock();
rtl_lock_work(tp);
__rtl8169_set_wol(tp, WAKE_PHY);
rtl_unlock_work(tp);
rtl8169_net_suspend(tp);
rtnl_unlock();
......@@ -4837,9 +4795,7 @@ static int rtl8169_runtime_resume(struct device *device)
rtl_rar_set(tp, tp->dev->dev_addr);
rtl_lock_work(tp);
__rtl8169_set_wol(tp, tp->saved_wolopts);
rtl_unlock_work(tp);
if (tp->TxDescArray)
rtl8169_up(tp);
......@@ -5296,7 +5252,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
return rc;
}
mutex_init(&tp->wk.mutex);
INIT_WORK(&tp->wk.work, rtl_task);
u64_stats_init(&tp->rx_stats.syncp);
u64_stats_init(&tp->tx_stats.syncp);
......
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