Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1419859

[PATCH 1/3] net: stmmac: allow to split suspend/resume from init/exit callbacks

From Vincent Palatin <vpalatin@chromium.org>
Newsgroups linux.kernel
Subject [PATCH 1/3] net: stmmac: allow to split suspend/resume from init/exit callbacks
Date 2016-06-11 03:10 +0200
Message-ID <rIFAZ-4Nk-1@gated-at.bofh.it> (permalink)
References <rItJw-4w2-25@gated-at.bofh.it> <rIFAZ-4Nk-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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: Vincent Palatin <vpalatin@chromium.org>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 8 ++++++--
 include/linux/stmmac.h                                | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 409db91..a96714d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -411,7 +411,9 @@ static int stmmac_pltfr_suspend(struct device *dev)
 	struct platform_device *pdev = to_platform_device(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);
 
 	return ret;
@@ -430,7 +432,9 @@ static int stmmac_pltfr_resume(struct device *dev)
 	struct stmmac_priv *priv = netdev_priv(ndev);
 	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);
 
 	return stmmac_resume(dev);
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index ffdaca9..0507dbf 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -135,6 +135,8 @@ struct plat_stmmacenet_data {
 	void (*bus_setup)(void __iomem *ioaddr);
 	int (*init)(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;
 	struct stmmac_axi *axi;
 	int has_gmac4;
-- 
2.8.0.rc3.226.g39d4020

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] net: stmmac: dwmac-rk: keep PHY up for WoL Vincent Palatin <vpalatin@chromium.org> - 2016-06-03 19:30 +0200
  Re: [PATCH] net: stmmac: dwmac-rk: keep PHY up for WoL Heiko Stübner <heiko@sntech.de> - 2016-06-06 22:50 +0200
    Re: [PATCH] net: stmmac: dwmac-rk: keep PHY up for WoL Vincent Palatin <vpalatin@chromium.org> - 2016-06-06 23:10 +0200
  Re: [PATCH] net: stmmac: dwmac-rk: keep PHY up for WoL Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2016-06-07 09:30 +0200
    Re: [PATCH] net: stmmac: dwmac-rk: keep PHY up for WoL Vincent Palatin <vpalatin@chromium.org> - 2016-06-09 00:30 +0200
      Re: [PATCH] net: stmmac: dwmac-rk: keep PHY up for WoL Andrew Lunn <andrew@lunn.ch> - 2016-06-09 02:20 +0200
        Re: [PATCH] net: stmmac: dwmac-rk: keep PHY up for WoL Vincent Palatin <vpalatin@chromium.org> - 2016-06-10 01:10 +0200
          Re: [PATCH] net: stmmac: dwmac-rk: keep PHY up for WoL Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2016-06-10 14:30 +0200
            [PATCH 2/3] net: stmmac: dwmac-rk: keep the PHY up for WoL Vincent Palatin <vpalatin@chromium.org> - 2016-06-11 03:10 +0200
              Re: [PATCH 2/3] net: stmmac: dwmac-rk: keep the PHY up for WoL Heiko Stuebner <heiko@sntech.de> - 2016-06-11 04:00 +0200
                Re: [PATCH 2/3] net: stmmac: dwmac-rk: keep the PHY up for WoL Vincent Palatin <vpalatin@chromium.org> - 2016-06-15 18:10 +0200
                [PATCH v2 0/3] net: stmmac: dwmac-rk: fixes for Wake-on-Lan on RK3288 Vincent Palatin <vpalatin@chromium.org> - 2016-06-15 20:40 +0200
                [PATCH v2 2/3] net: stmmac: dwmac-rk: keep the PHY up for WoL Vincent Palatin <vpalatin@chromium.org> - 2016-06-15 20:40 +0200
                [PATCH v2 1/3] net: stmmac: allow to split suspend/resume from init/exit callbacks Vincent Palatin <vpalatin@chromium.org> - 2016-06-15 20:40 +0200
                [PATCH v2 3/3] ARM: dts: rockchip: add interrupt for Wake-on-Lan on RK3288 Vincent Palatin <vpalatin@chromium.org> - 2016-06-15 20:40 +0200
                Re: [PATCH v2 0/3] net: stmmac: dwmac-rk: fixes for Wake-on-Lan on  RK3288 David Miller <davem@davemloft.net> - 2016-06-16 23:20 +0200
            [PATCH 1/3] net: stmmac: allow to split suspend/resume from init/exit callbacks Vincent Palatin <vpalatin@chromium.org> - 2016-06-11 03:10 +0200
              Re: [PATCH 1/3] net: stmmac: allow to split suspend/resume from  init/exit callbacks David Miller <davem@davemloft.net> - 2016-06-11 03:20 +0200
            net: stmmac: dwmac-rk: fixes for Wake-on-Lan on RK3288 Vincent Palatin <vpalatin@chromium.org> - 2016-06-11 03:10 +0200
              [PATCH 3/3] ARM: dts: rockchip: add interrupt for Wake-on-Lan on RK3288 Vincent Palatin <vpalatin@chromium.org> - 2016-06-11 03:10 +0200
              Re: net: stmmac: dwmac-rk: fixes for Wake-on-Lan on RK3288 David Miller <davem@davemloft.net> - 2016-06-11 03:20 +0200
              Re: net: stmmac: dwmac-rk: fixes for Wake-on-Lan on RK3288 Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2016-06-13 08:50 +0200
                Re: net: stmmac: dwmac-rk: fixes for Wake-on-Lan on RK3288 Vincent Palatin <vpalatin@chromium.org> - 2016-06-15 19:10 +0200
                Re: net: stmmac: dwmac-rk: fixes for Wake-on-Lan on RK3288 Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2016-06-16 15:40 +0200
                Re: net: stmmac: dwmac-rk: fixes for Wake-on-Lan on RK3288 Vincent Palatin <vpalatin@chromium.org> - 2016-06-16 17:00 +0200
                Re: net: stmmac: dwmac-rk: fixes for Wake-on-Lan on RK3288 Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2016-06-17 07:40 +0200

csiph-web