Message ID | 20221101011139.900930-1-andy.chiu@sifive.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [net-next] net: axiemac: add PM callbacks to support suspend/resume | expand |
On 31/10/2022 21:11, Andy Chiu wrote: > Support basic system-wide suspend and resume functions > > Signed-off-by: Andy Chiu <andy.chiu@sifive.com> > --- > .../net/ethernet/xilinx/xilinx_axienet_main.c | 36 +++++++++++++++++++ > 1 file changed, 36 insertions(+) > Why Ccing us? Best regards, Krzysztof
Hello: This patch was applied to netdev/net-next.git (master) by David S. Miller <davem@davemloft.net>: On Tue, 1 Nov 2022 09:11:39 +0800 you wrote: > Support basic system-wide suspend and resume functions > > Signed-off-by: Andy Chiu <andy.chiu@sifive.com> > --- > .../net/ethernet/xilinx/xilinx_axienet_main.c | 36 +++++++++++++++++++ > 1 file changed, 36 insertions(+) Here is the summary with links: - [net-next] net: axiemac: add PM callbacks to support suspend/resume https://git.kernel.org/netdev/net-next/c/a3de357b087e You are awesome, thank you!
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 441e1058104f..d082f2b10f4d 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -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, }, };
Support basic system-wide suspend and resume functions Signed-off-by: Andy Chiu <andy.chiu@sifive.com> --- .../net/ethernet/xilinx/xilinx_axienet_main.c | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+)