diff options
author | Francesco Virlinzi <francesco.virlinzi@st.com> | 2012-04-18 15:48:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-19 20:08:44 -0400 |
commit | 3256251f9850d00c8e4a4fd82440092bb0f1fd7d (patch) | |
tree | 8326e0a296ed075a78182a19b8e8a4391b72e538 | |
parent | a104104fd70b5a8d03162468701f499901e250d2 (diff) |
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>
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 17 | ||||
-rw-r--r-- | 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 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) | |||
189 | if (priv->plat->exit) | 189 | if (priv->plat->exit) |
190 | priv->plat->exit(pdev); | 190 | priv->plat->exit(pdev); |
191 | 191 | ||
192 | if (priv->plat->exit) | ||
193 | priv->plat->exit(pdev); | ||
194 | |||
195 | platform_set_drvdata(pdev, NULL); | 192 | platform_set_drvdata(pdev, NULL); |
196 | 193 | ||
197 | iounmap((void *)priv->ioaddr); | 194 | iounmap((void *)priv->ioaddr); |
@@ -218,14 +215,26 @@ static int stmmac_pltfr_resume(struct device *dev) | |||
218 | 215 | ||
219 | int stmmac_pltfr_freeze(struct device *dev) | 216 | int stmmac_pltfr_freeze(struct device *dev) |
220 | { | 217 | { |
218 | int ret; | ||
219 | struct plat_stmmacenet_data *plat_dat = dev_get_platdata(dev); | ||
221 | struct net_device *ndev = dev_get_drvdata(dev); | 220 | struct net_device *ndev = dev_get_drvdata(dev); |
221 | struct platform_device *pdev = to_platform_device(dev); | ||
222 | 222 | ||
223 | return stmmac_freeze(ndev); | 223 | ret = stmmac_freeze(ndev); |
224 | if (plat_dat->exit) | ||
225 | plat_dat->exit(pdev); | ||
226 | |||
227 | return ret; | ||
224 | } | 228 | } |
225 | 229 | ||
226 | int stmmac_pltfr_restore(struct device *dev) | 230 | int stmmac_pltfr_restore(struct device *dev) |
227 | { | 231 | { |
232 | struct plat_stmmacenet_data *plat_dat = dev_get_platdata(dev); | ||
228 | struct net_device *ndev = dev_get_drvdata(dev); | 233 | struct net_device *ndev = dev_get_drvdata(dev); |
234 | struct platform_device *pdev = to_platform_device(dev); | ||
235 | |||
236 | if (plat_dat->init) | ||
237 | plat_dat->init(pdev); | ||
229 | 238 | ||
230 | return stmmac_restore(ndev); | 239 | return stmmac_restore(ndev); |
231 | } | 240 | } |
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index cf6403186359..f85c93d6e6da 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h | |||
@@ -109,6 +109,7 @@ struct plat_stmmacenet_data { | |||
109 | int (*init)(struct platform_device *pdev); | 109 | int (*init)(struct platform_device *pdev); |
110 | void (*exit)(struct platform_device *pdev); | 110 | void (*exit)(struct platform_device *pdev); |
111 | void *custom_cfg; | 111 | void *custom_cfg; |
112 | void *custom_data; | ||
112 | void *bsp_priv; | 113 | void *bsp_priv; |
113 | }; | 114 | }; |
114 | #endif | 115 | #endif |