Commit a3de357b authored by Andy Chiu's avatar Andy Chiu Committed by David S. Miller

net: axiemac: add PM callbacks to support suspend/resume

Support basic system-wide suspend and resume functions
Signed-off-by: default avatarAndy Chiu <andy.chiu@sifive.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d08cb255
......@@ -2217,12 +2217,48 @@ static void axienet_shutdown(struct platform_device *pdev)
rtnl_unlock();
}
static int axienet_suspend(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
if (!netif_running(ndev))
return 0;
netif_device_detach(ndev);
rtnl_lock();
axienet_stop(ndev);
rtnl_unlock();
return 0;
}
static int axienet_resume(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
if (!netif_running(ndev))
return 0;
rtnl_lock();
axienet_open(ndev);
rtnl_unlock();
netif_device_attach(ndev);
return 0;
}
static DEFINE_SIMPLE_DEV_PM_OPS(axienet_pm_ops,
axienet_suspend, axienet_resume);
static struct platform_driver axienet_driver = {
.probe = axienet_probe,
.remove = axienet_remove,
.shutdown = axienet_shutdown,
.driver = {
.name = "xilinx_axienet",
.pm = &axienet_pm_ops,
.of_match_table = axienet_of_match,
},
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment