summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-01-27 00:26:46 +0100
committerDavid S. Miller <davem@davemloft.net>2015-01-27 00:26:46 +0100
commit4141d93fc55a33bbe74c9de48f1f99dd85bf0441 (patch)
tree442d27b1ab2abe6bf1aca088b5a35fcfc54ac62a
parentnet: stmmac: add BQL support (diff)
parentsh_eth: add more PM methods (diff)
downloadlinux-4141d93fc55a33bbe74c9de48f1f99dd85bf0441.tar.xz
linux-4141d93fc55a33bbe74c9de48f1f99dd85bf0441.zip
Merge branch 'sh_eth'
Sergei Shtylyov says: ==================== sh_eth: massage PM code Here's a set of 2 patches against DaveM's 'net-next.git' repo. We're adding the support for suspend/hibernation as well as somewhat changing the existing code. There are still MDIO-related issue with suspend (kernel exception), we've been working on it and shall address it with a separate patch... ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 167737fa59de..fe0277a35507 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2947,6 +2947,36 @@ static int sh_eth_drv_remove(struct platform_device *pdev)
}
#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
+static int sh_eth_suspend(struct device *dev)
+{
+ struct net_device *ndev = dev_get_drvdata(dev);
+ int ret = 0;
+
+ if (netif_running(ndev)) {
+ netif_device_detach(ndev);
+ ret = sh_eth_close(ndev);
+ }
+
+ return ret;
+}
+
+static int sh_eth_resume(struct device *dev)
+{
+ struct net_device *ndev = dev_get_drvdata(dev);
+ int ret = 0;
+
+ if (netif_running(ndev)) {
+ ret = sh_eth_open(ndev);
+ if (ret < 0)
+ return ret;
+ netif_device_attach(ndev);
+ }
+
+ return ret;
+}
+#endif
+
static int sh_eth_runtime_nop(struct device *dev)
{
/* Runtime PM callback shared between ->runtime_suspend()
@@ -2960,8 +2990,8 @@ static int sh_eth_runtime_nop(struct device *dev)
}
static const struct dev_pm_ops sh_eth_dev_pm_ops = {
- .runtime_suspend = sh_eth_runtime_nop,
- .runtime_resume = sh_eth_runtime_nop,
+ SET_SYSTEM_SLEEP_PM_OPS(sh_eth_suspend, sh_eth_resume)
+ SET_RUNTIME_PM_OPS(sh_eth_runtime_nop, sh_eth_runtime_nop, NULL)
};
#define SH_ETH_PM_OPS (&sh_eth_dev_pm_ops)
#else