提交 3256251f 编写于 作者: F Francesco Virlinzi 提交者: David S. Miller

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: NFrancesco Virlinzi <francesco.virlinzi@st.com>
Signed-off-by: NGiuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a104104f
...@@ -186,9 +186,6 @@ static int stmmac_pltfr_remove(struct platform_device *pdev) ...@@ -186,9 +186,6 @@ static int stmmac_pltfr_remove(struct platform_device *pdev)
struct resource *res; struct resource *res;
int ret = stmmac_dvr_remove(ndev); int ret = stmmac_dvr_remove(ndev);
if (priv->plat->exit)
priv->plat->exit(pdev);
if (priv->plat->exit) if (priv->plat->exit)
priv->plat->exit(pdev); priv->plat->exit(pdev);
...@@ -218,14 +215,26 @@ static int stmmac_pltfr_resume(struct device *dev) ...@@ -218,14 +215,26 @@ static int stmmac_pltfr_resume(struct device *dev)
int stmmac_pltfr_freeze(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 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) 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 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); return stmmac_restore(ndev);
} }
......
...@@ -109,6 +109,7 @@ struct plat_stmmacenet_data { ...@@ -109,6 +109,7 @@ struct plat_stmmacenet_data {
int (*init)(struct platform_device *pdev); int (*init)(struct platform_device *pdev);
void (*exit)(struct platform_device *pdev); void (*exit)(struct platform_device *pdev);
void *custom_cfg; void *custom_cfg;
void *custom_data;
void *bsp_priv; void *bsp_priv;
}; };
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册