diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 5e867da1aad3..4ae1a6fbf0ba 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -2239,14 +2239,10 @@ static void rtl_pll_power_down(struct rtl8169_private *tp) default: break; } - - clk_disable_unprepare(tp->clk); } static void rtl_pll_power_up(struct rtl8169_private *tp) { - clk_prepare_enable(tp->clk); - switch (tp->mac_version) { case RTL_GIGA_MAC_VER_25 ... RTL_GIGA_MAC_VER_33: case RTL_GIGA_MAC_VER_37: @@ -4826,21 +4822,8 @@ static void rtl8169_net_suspend(struct rtl8169_private *tp) #ifdef CONFIG_PM -static int __maybe_unused rtl8169_suspend(struct device *device) +static int rtl8169_net_resume(struct rtl8169_private *tp) { - struct rtl8169_private *tp = dev_get_drvdata(device); - - rtnl_lock(); - rtl8169_net_suspend(tp); - rtnl_unlock(); - - return 0; -} - -static int rtl8169_resume(struct device *device) -{ - struct rtl8169_private *tp = dev_get_drvdata(device); - rtl_rar_set(tp, tp->dev->dev_addr); if (tp->TxDescArray) @@ -4851,6 +4834,29 @@ static int rtl8169_resume(struct device *device) return 0; } +static int __maybe_unused rtl8169_suspend(struct device *device) +{ + struct rtl8169_private *tp = dev_get_drvdata(device); + + rtnl_lock(); + rtl8169_net_suspend(tp); + if (!device_may_wakeup(tp_to_dev(tp))) + clk_disable_unprepare(tp->clk); + rtnl_unlock(); + + return 0; +} + +static int __maybe_unused rtl8169_resume(struct device *device) +{ + struct rtl8169_private *tp = dev_get_drvdata(device); + + if (!device_may_wakeup(tp_to_dev(tp))) + clk_prepare_enable(tp->clk); + + return rtl8169_net_resume(tp); +} + static int rtl8169_runtime_suspend(struct device *device) { struct rtl8169_private *tp = dev_get_drvdata(device); @@ -4874,7 +4880,7 @@ static int rtl8169_runtime_resume(struct device *device) __rtl8169_set_wol(tp, tp->saved_wolopts); - return rtl8169_resume(device); + return rtl8169_net_resume(tp); } static int rtl8169_runtime_idle(struct device *device)