r8169: Disable clk during suspend / resume
authorHans de Goede <hdegoede@redhat.com>
Wed, 26 Sep 2018 20:12:39 +0000 (22:12 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 29 Sep 2018 18:47:57 +0000 (11:47 -0700)
Disable the clk during suspend to save power. Note that tp->clk may be
NULL, the clk core functions handle this without problems.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/realtek/r8169.c

index ab30aaeac6d377e6303fafc57f820e3022ae7773..d6b53f53909a23c60ab6a48935e1ba0441ccf4f8 100644 (file)
@@ -6869,8 +6869,10 @@ static int rtl8169_suspend(struct device *device)
 {
        struct pci_dev *pdev = to_pci_dev(device);
        struct net_device *dev = pci_get_drvdata(pdev);
+       struct rtl8169_private *tp = netdev_priv(dev);
 
        rtl8169_net_suspend(dev);
+       clk_disable_unprepare(tp->clk);
 
        return 0;
 }
@@ -6898,6 +6900,9 @@ static int rtl8169_resume(struct device *device)
 {
        struct pci_dev *pdev = to_pci_dev(device);
        struct net_device *dev = pci_get_drvdata(pdev);
+       struct rtl8169_private *tp = netdev_priv(dev);
+
+       clk_prepare_enable(tp->clk);
 
        if (netif_running(dev))
                __rtl8169_resume(dev);