netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] sh_eth: massage PM code
@ 2015-01-21 22:16 Sergei Shtylyov
  2015-01-21 22:18 ` [PATCH 1/2] sh_eth: use SET_RUNTIME_PM_OPS() Sergei Shtylyov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-01-21 22:16 UTC (permalink / raw)
  To: netdev; +Cc: linux-sh

Hello.

   Here's a set of 2 patches against DaveM's 'net-next.git' repo. We're adding
the support for suspend/hibernation as well as somewhat changing the existing
code. There are still MDIO-related issue with suspend (kernel exception), we've
been working on it and shall address it with a separate patch...

[1/2] sh_eth: use SET_RUNTIME_PM_OPS()
[2/2] sh_eth: add more PM methods

WBR, Sergei


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] sh_eth: use SET_RUNTIME_PM_OPS()
  2015-01-21 22:16 [PATCH 0/2] sh_eth: massage PM code Sergei Shtylyov
@ 2015-01-21 22:18 ` Sergei Shtylyov
  2015-01-21 22:19 ` [PATCH 2/2] sh_eth: add more PM methods Sergei Shtylyov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-01-21 22:18 UTC (permalink / raw)
  To: netdev; +Cc: linux-sh, mikhail.ulyanov

From: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>

Use SET_RUNTIME_PM_OPS() macro to initialize the runtime PM method pointers in
the 'struct dev_pm_ops'.

Signed-off-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
[Sergei: renamed, added the changelog.]
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 drivers/net/ethernet/renesas/sh_eth.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -2960,8 +2960,7 @@ static int sh_eth_runtime_nop(struct dev
 }
 
 static const struct dev_pm_ops sh_eth_dev_pm_ops = {
-	.runtime_suspend = sh_eth_runtime_nop,
-	.runtime_resume = sh_eth_runtime_nop,
+	SET_RUNTIME_PM_OPS(sh_eth_runtime_nop, sh_eth_runtime_nop, NULL)
 };
 #define SH_ETH_PM_OPS (&sh_eth_dev_pm_ops)
 #else


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] sh_eth: add more PM methods
  2015-01-21 22:16 [PATCH 0/2] sh_eth: massage PM code Sergei Shtylyov
  2015-01-21 22:18 ` [PATCH 1/2] sh_eth: use SET_RUNTIME_PM_OPS() Sergei Shtylyov
@ 2015-01-21 22:19 ` Sergei Shtylyov
  2015-01-26 23:27 ` [PATCH 0/2] sh_eth: massage PM code David Miller
  2015-01-27 19:06 ` Sergei Shtylyov
  3 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-01-21 22:19 UTC (permalink / raw)
  To: netdev; +Cc: linux-sh, mikhail.ulyanov

From: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>

Add sh_eth_{suspend|resume}() implementing {suspend|resume|freeze|thaw|poweroff|
restore}() PM methods to make it possible to restore from hibernation not only
in Linux  but also in e.g. U-Boot and  to have more determined state on resume/
restore.

Signed-off-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
[Sergei: moved sh_eth_{suspend|resume}() before sh_eth_runtime_nop(), enclosed
them with #ifdef CONFIG_PM_SLEEP, reordered the local variables, got rid of
*goto* and label, reordered macro invocations, renamed, modified the changelog.]
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 drivers/net/ethernet/renesas/sh_eth.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -2947,6 +2947,36 @@ static int sh_eth_drv_remove(struct plat
 }
 
 #ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
+static int sh_eth_suspend(struct device *dev)
+{
+	struct net_device *ndev = dev_get_drvdata(dev);
+	int ret = 0;
+
+	if (netif_running(ndev)) {
+		netif_device_detach(ndev);
+		ret = sh_eth_close(ndev);
+	}
+
+	return ret;
+}
+
+static int sh_eth_resume(struct device *dev)
+{
+	struct net_device *ndev = dev_get_drvdata(dev);
+	int ret = 0;
+
+	if (netif_running(ndev)) {
+		ret = sh_eth_open(ndev);
+		if (ret < 0)
+			return ret;
+		netif_device_attach(ndev);
+	}
+
+	return ret;
+}
+#endif
+
 static int sh_eth_runtime_nop(struct device *dev)
 {
 	/* Runtime PM callback shared between ->runtime_suspend()
@@ -2960,6 +2990,7 @@ static int sh_eth_runtime_nop(struct dev
 }
 
 static const struct dev_pm_ops sh_eth_dev_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(sh_eth_suspend, sh_eth_resume)
 	SET_RUNTIME_PM_OPS(sh_eth_runtime_nop, sh_eth_runtime_nop, NULL)
 };
 #define SH_ETH_PM_OPS (&sh_eth_dev_pm_ops)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] sh_eth: massage PM code
  2015-01-21 22:16 [PATCH 0/2] sh_eth: massage PM code Sergei Shtylyov
  2015-01-21 22:18 ` [PATCH 1/2] sh_eth: use SET_RUNTIME_PM_OPS() Sergei Shtylyov
  2015-01-21 22:19 ` [PATCH 2/2] sh_eth: add more PM methods Sergei Shtylyov
@ 2015-01-26 23:27 ` David Miller
  2015-01-27 19:06 ` Sergei Shtylyov
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-01-26 23:27 UTC (permalink / raw)
  To: sergei.shtylyov; +Cc: netdev, linux-sh

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Thu, 22 Jan 2015 01:16:54 +0300

>    Here's a set of 2 patches against DaveM's 'net-next.git' repo. We're adding
> the support for suspend/hibernation as well as somewhat changing the existing
> code. There are still MDIO-related issue with suspend (kernel exception), we've
> been working on it and shall address it with a separate patch...

Series applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] sh_eth: massage PM code
  2015-01-21 22:16 [PATCH 0/2] sh_eth: massage PM code Sergei Shtylyov
                   ` (2 preceding siblings ...)
  2015-01-26 23:27 ` [PATCH 0/2] sh_eth: massage PM code David Miller
@ 2015-01-27 19:06 ` Sergei Shtylyov
  3 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-01-27 19:06 UTC (permalink / raw)
  To: netdev, David Miller; +Cc: linux-sh

Hello.

On 01/22/2015 01:16 AM, Sergei Shtylyov wrote:

>     Here's a set of 2 patches against DaveM's 'net-next.git' repo. We're adding
> the support for suspend/hibernation as well as somewhat changing the existing
> code. There are still MDIO-related issue with suspend (kernel exception), we've
> been working on it and shall address it with a separate patch...

    It turned out that Florian Fainelli's recent series was the best approach 
to fixing this issue. We were only looking at our driver while it was a common 
MDIO problem...

> [1/2] sh_eth: use SET_RUNTIME_PM_OPS()
> [2/2] sh_eth: add more PM methods

WBR, Sergei


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-01-27 19:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 22:16 [PATCH 0/2] sh_eth: massage PM code Sergei Shtylyov
2015-01-21 22:18 ` [PATCH 1/2] sh_eth: use SET_RUNTIME_PM_OPS() Sergei Shtylyov
2015-01-21 22:19 ` [PATCH 2/2] sh_eth: add more PM methods Sergei Shtylyov
2015-01-26 23:27 ` [PATCH 0/2] sh_eth: massage PM code David Miller
2015-01-27 19:06 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).