aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFrancesco Virlinzi <francesco.virlinzi@st.com>2012-04-18 19:48:19 +0000
committerDavid S. Miller <davem@davemloft.net>2012-04-19 20:08:44 -0400
commit3256251f9850d00c8e4a4fd82440092bb0f1fd7d (patch)
tree8326e0a296ed075a78182a19b8e8a4391b72e538 /drivers
parentiwlwifi: Remove inconsistent and redundant declaration (diff)
downloadlinux-dev-3256251f9850d00c8e4a4fd82440092bb0f1fd7d.tar.xz
linux-dev-3256251f9850d00c8e4a4fd82440092bb0f1fd7d.zip
stmmac: use custom init/exit functions in pm ops
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 12bd221561e5..ba30d38a6caf 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);
}