Skip to content

Commit

Permalink
stmmac: use custom init/exit functions in pm ops
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Francesco Virlinzi authored and davem330 committed Apr 20, 2012
1 parent a104104 commit 3256251
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 13 additions & 4 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ static int stmmac_pltfr_remove(struct platform_device *pdev)
struct resource *res;
int ret = stmmac_dvr_remove(ndev);

if (priv->plat->exit)
priv->plat->exit(pdev);

if (priv->plat->exit)
priv->plat->exit(pdev);

Expand Down Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions include/linux/stmmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3256251

Please sign in to comment.