Commit cecbc556 authored by Vincent Palatin's avatar Vincent Palatin Committed by David S. Miller

net: stmmac: allow to split suspend/resume from init/exit callbacks

Let the stmmac platform drivers provide dedicated suspend and resume
callbacks rather than always re-using the init and exits callbacks.
If the driver does not provide the suspend or resume callback, we fall
back to the old behavior trying to use exit or init.

This allows a specific platform to perform only a partial power-down on
suspend if Wake-on-Lan is enabled but always perform the full shutdown
sequence if the module is unloaded.
Signed-off-by: default avatarVincent Palatin <vpalatin@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 141ddefc
...@@ -411,7 +411,9 @@ static int stmmac_pltfr_suspend(struct device *dev) ...@@ -411,7 +411,9 @@ static int stmmac_pltfr_suspend(struct device *dev)
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
ret = stmmac_suspend(dev); ret = stmmac_suspend(dev);
if (priv->plat->exit) if (priv->plat->suspend)
priv->plat->suspend(pdev, priv->plat->bsp_priv);
else if (priv->plat->exit)
priv->plat->exit(pdev, priv->plat->bsp_priv); priv->plat->exit(pdev, priv->plat->bsp_priv);
return ret; return ret;
...@@ -430,7 +432,9 @@ static int stmmac_pltfr_resume(struct device *dev) ...@@ -430,7 +432,9 @@ static int stmmac_pltfr_resume(struct device *dev)
struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_priv *priv = netdev_priv(ndev);
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
if (priv->plat->init) if (priv->plat->resume)
priv->plat->resume(pdev, priv->plat->bsp_priv);
else if (priv->plat->init)
priv->plat->init(pdev, priv->plat->bsp_priv); priv->plat->init(pdev, priv->plat->bsp_priv);
return stmmac_resume(dev); return stmmac_resume(dev);
......
...@@ -135,6 +135,8 @@ struct plat_stmmacenet_data { ...@@ -135,6 +135,8 @@ struct plat_stmmacenet_data {
void (*bus_setup)(void __iomem *ioaddr); void (*bus_setup)(void __iomem *ioaddr);
int (*init)(struct platform_device *pdev, void *priv); int (*init)(struct platform_device *pdev, void *priv);
void (*exit)(struct platform_device *pdev, void *priv); void (*exit)(struct platform_device *pdev, void *priv);
void (*suspend)(struct platform_device *pdev, void *priv);
void (*resume)(struct platform_device *pdev, void *priv);
void *bsp_priv; void *bsp_priv;
struct stmmac_axi *axi; struct stmmac_axi *axi;
int has_gmac4; int has_gmac4;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment