diff options
-rw-r--r-- | drivers/net/ethernet/renesas/sh_eth.c | 34 |
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) | |||
2947 | } | 2947 | } |
2948 | 2948 | ||
2949 | #ifdef CONFIG_PM | 2949 | #ifdef CONFIG_PM |
2950 | #ifdef CONFIG_PM_SLEEP | ||
2951 | static int sh_eth_suspend(struct device *dev) | ||
2952 | { | ||
2953 | struct net_device *ndev = dev_get_drvdata(dev); | ||
2954 | int ret = 0; | ||
2955 | |||
2956 | if (netif_running(ndev)) { | ||
2957 | netif_device_detach(ndev); | ||
2958 | ret = sh_eth_close(ndev); | ||
2959 | } | ||
2960 | |||
2961 | return ret; | ||
2962 | } | ||
2963 | |||
2964 | static int sh_eth_resume(struct device *dev) | ||
2965 | { | ||
2966 | struct net_device *ndev = dev_get_drvdata(dev); | ||
2967 | int ret = 0; | ||
2968 | |||
2969 | if (netif_running(ndev)) { | ||
2970 | ret = sh_eth_open(ndev); | ||
2971 | if (ret < 0) | ||
2972 | return ret; | ||
2973 | netif_device_attach(ndev); | ||
2974 | } | ||
2975 | |||
2976 | return ret; | ||
2977 | } | ||
2978 | #endif | ||
2979 | |||
2950 | static int sh_eth_runtime_nop(struct device *dev) | 2980 | static int sh_eth_runtime_nop(struct device *dev) |
2951 | { | 2981 | { |
2952 | /* Runtime PM callback shared between ->runtime_suspend() | 2982 | /* Runtime PM callback shared between ->runtime_suspend() |
@@ -2960,8 +2990,8 @@ static int sh_eth_runtime_nop(struct device *dev) | |||
2960 | } | 2990 | } |
2961 | 2991 | ||
2962 | static const struct dev_pm_ops sh_eth_dev_pm_ops = { | 2992 | static const struct dev_pm_ops sh_eth_dev_pm_ops = { |
2963 | .runtime_suspend = sh_eth_runtime_nop, | 2993 | SET_SYSTEM_SLEEP_PM_OPS(sh_eth_suspend, sh_eth_resume) |
2964 | .runtime_resume = sh_eth_runtime_nop, | 2994 | SET_RUNTIME_PM_OPS(sh_eth_runtime_nop, sh_eth_runtime_nop, NULL) |
2965 | }; | 2995 | }; |
2966 | #define SH_ETH_PM_OPS (&sh_eth_dev_pm_ops) | 2996 | #define SH_ETH_PM_OPS (&sh_eth_dev_pm_ops) |
2967 | #else | 2997 | #else |