Skip to content

Commit 8ac8e8c

Browse files
hkallweitdavem330
authored andcommitted
r8169: make rtl8169_down central chip quiesce function
Functionality for quiescing the chip is spread across different functions currently. Move it to rtl8169_down(). Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bac75d8 commit 8ac8e8c

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4627,20 +4627,21 @@ static int r8169_phy_connect(struct rtl8169_private *tp)
46274627
return 0;
46284628
}
46294629

4630-
static void rtl8169_down(struct net_device *dev)
4630+
static void rtl8169_down(struct rtl8169_private *tp)
46314631
{
4632-
struct rtl8169_private *tp = netdev_priv(dev);
4632+
rtl_lock_work(tp);
46334633

4634-
phy_stop(tp->phydev);
4634+
/* Clear all task flags */
4635+
bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
46354636

4637+
phy_stop(tp->phydev);
46364638
napi_disable(&tp->napi);
4637-
netif_stop_queue(dev);
46384639

46394640
rtl8169_hw_reset(tp);
46404641

4641-
rtl8169_rx_clear(tp);
4642-
46434642
rtl_pll_power_down(tp);
4643+
4644+
rtl_unlock_work(tp);
46444645
}
46454646

46464647
static int rtl8169_close(struct net_device *dev)
@@ -4653,12 +4654,9 @@ static int rtl8169_close(struct net_device *dev)
46534654
/* Update counters before going down */
46544655
rtl8169_update_counters(tp);
46554656

4656-
rtl_lock_work(tp);
4657-
/* Clear all task flags */
4658-
bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
4659-
4660-
rtl8169_down(dev);
4661-
rtl_unlock_work(tp);
4657+
netif_stop_queue(dev);
4658+
rtl8169_down(tp);
4659+
rtl8169_rx_clear(tp);
46624660

46634661
cancel_work_sync(&tp->wk.work);
46644662

@@ -4817,17 +4815,8 @@ static void rtl8169_net_suspend(struct rtl8169_private *tp)
48174815
if (!netif_running(tp->dev))
48184816
return;
48194817

4820-
phy_stop(tp->phydev);
48214818
netif_device_detach(tp->dev);
4822-
4823-
rtl_lock_work(tp);
4824-
napi_disable(&tp->napi);
4825-
/* Clear all task flags */
4826-
bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
4827-
4828-
rtl_unlock_work(tp);
4829-
4830-
rtl_pll_power_down(tp);
4819+
rtl8169_down(tp);
48314820
}
48324821

48334822
#ifdef CONFIG_PM

0 commit comments

Comments
 (0)