netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next 1/4] stmmac: use custom init/exit functions in pm ops
@ 2012-04-19  5:48 Giuseppe CAVALLARO
  2012-04-19  5:48 ` [net-next 2/4 (v2)] stmmac: Move the mdio_register/_unregister in probe/remove Giuseppe CAVALLARO
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Giuseppe CAVALLARO @ 2012-04-19  5:48 UTC (permalink / raw)
  To: netdev; +Cc: Francesco Virlinzi, Giuseppe Cavallaro

From: Francesco Virlinzi <francesco.virlinzi@st.com>

Freeze and restore can call the custom init/exit functions.
Also the patch adds a custom data field that can be used
for storing platform data useful on restore the embedded
setup (e.g. GPIO, SYSCFG).

Signed-off-by: Francesco Virlinzi <francesco.virlinzi@st.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   17 +++++++++++++----
 include/linux/stmmac.h                             |    1 +
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 12bd221..ba30d38 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -189,9 +189,6 @@ static int stmmac_pltfr_remove(struct platform_device *pdev)
 	if (priv->plat->exit)
 		priv->plat->exit(pdev);
 
-	if (priv->plat->exit)
-		priv->plat->exit(pdev);
-
 	platform_set_drvdata(pdev, NULL);
 
 	iounmap((void *)priv->ioaddr);
@@ -218,14 +215,26 @@ static int stmmac_pltfr_resume(struct device *dev)
 
 int stmmac_pltfr_freeze(struct device *dev)
 {
+	int ret;
+	struct plat_stmmacenet_data *plat_dat = dev_get_platdata(dev);
 	struct net_device *ndev = dev_get_drvdata(dev);
+	struct platform_device *pdev = to_platform_device(dev);
 
-	return stmmac_freeze(ndev);
+	ret = stmmac_freeze(ndev);
+	if (plat_dat->exit)
+		plat_dat->exit(pdev);
+
+	return ret;
 }
 
 int stmmac_pltfr_restore(struct device *dev)
 {
+	struct plat_stmmacenet_data *plat_dat = dev_get_platdata(dev);
 	struct net_device *ndev = dev_get_drvdata(dev);
+	struct platform_device *pdev = to_platform_device(dev);
+
+	if (plat_dat->init)
+		plat_dat->init(pdev);
 
 	return stmmac_restore(ndev);
 }
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index cf64031..f85c93d 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -109,6 +109,7 @@ struct plat_stmmacenet_data {
 	int (*init)(struct platform_device *pdev);
 	void (*exit)(struct platform_device *pdev);
 	void *custom_cfg;
+	void *custom_data;
 	void *bsp_priv;
 };
 #endif
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-04-20  0:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-19  5:48 [net-next 1/4] stmmac: use custom init/exit functions in pm ops Giuseppe CAVALLARO
2012-04-19  5:48 ` [net-next 2/4 (v2)] stmmac: Move the mdio_register/_unregister in probe/remove Giuseppe CAVALLARO
2012-04-20  0:09   ` David Miller
2012-04-19  5:48 ` [net-next 3/4] stmmac: verify the dma_cfg platform fields Giuseppe CAVALLARO
2012-04-19  6:05   ` Viresh Kumar
2012-04-19  6:29     ` Giuseppe CAVALLARO
2012-04-20  0:09   ` David Miller
2012-04-19  5:48 ` [net-next 4/4] stmmac: do not fail when probe and there is no csr clk defined Giuseppe CAVALLARO
2012-04-20  0:09   ` David Miller
2012-04-20  0:06 ` [net-next 1/4] stmmac: use custom init/exit functions in pm ops David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).