Thread (15 messages) 15 messages, 3 authors, 2016-11-04

Re: [net-next PATCH 3/7] stmmac: dwmac-sti: add PM ops and resume function

From: Joachim Eastwood <hidden>
Date: 2016-11-01 17:19:43

On 30 October 2016 at 21:05, Joachim Eastwood [off-list ref] wrote:
Implement PM callbacks and driver remove in the driver instead
of relying on the init/exit hooks in stmmac_platform. This gives
the driver more flexibility in how the code is organized.

Eventually the init/exit callbacks will be deprecated in favor
of the standard PM callbacks and driver remove function.

Signed-off-by: Joachim Eastwood <redacted>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 46 +++++++++++++++++++------
 1 file changed, 36 insertions(+), 10 deletions(-)
+#ifdef CONFIG_PM_SLEEP
+static int sti_dwmac_suspend(struct device *dev)
+{
+       struct sti_dwmac *dwmac = get_stmmac_bsp_priv(dev);
+       int ret = stmmac_suspend(dev);
+
+       clk_disable_unprepare(dwmac->clk);
+
+       return ret;
+}
+
+static int sti_dwmac_resume(struct device *dev)
+{
+       struct sti_dwmac *dwmac = get_stmmac_bsp_priv(dev);
+       struct platform_device *pdev = to_platform_device(dev);
+
+       sti_dwmac_init(pdev, dwmac);
+
+       return stmmac_resume(dev);
+}
+#endif /* CONFIG_PM_SLEEP */
+
+SIMPLE_DEV_PM_OPS(sti_dwmac_pm_ops, sti_dwmac_suspend, sti_dwmac_resume);
Just noticed that I am missing a 'static' here.

As this not critical for testing I'll resend the patch set after I
(hopefully) get some response from someone with the hw that can do a
test.


regards,
Joachim Eastwood
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help