diff mbox

[10/10,RFC] sh_eth: Remove obsolete explicit clock handling for WoL

Message ID 1508162116-5043-11-git-send-email-geert+renesas@glider.be (mailing list archive)
State RFC, archived
Headers show

Commit Message

Geert Uytterhoeven Oct. 16, 2017, 1:55 p.m. UTC
Currently, if Wake-on-LAN is enabled, the SH-ETH device's module clock
is manually kept running during system suspend, to make sure the device
stays active.

Since "soc: renesas: rcar-sysc: Keep wakeup sources active during system
suspend" and "clk: renesas: mstp: Keep wakeup sources active during
system suspend", this workaround is no longer needed.  Hence remove all
explicit clock handling to keep the device active.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This must not be applied before the dependency has landed upstream,
hence the "RFC"!
---
 drivers/net/ethernet/renesas/sh_eth.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

Comments

Niklas Söderlund Oct. 16, 2017, 3:15 p.m. UTC | #1
Hi Geert,

On 2017-10-16 15:55:16 +0200, Geert Uytterhoeven wrote:
> Currently, if Wake-on-LAN is enabled, the SH-ETH device's module clock
> is manually kept running during system suspend, to make sure the device
> stays active.
> 
> Since "soc: renesas: rcar-sysc: Keep wakeup sources active during system
> suspend" and "clk: renesas: mstp: Keep wakeup sources active during
> system suspend", this workaround is no longer needed.  Hence remove all
> explicit clock handling to keep the device active.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
> This must not be applied before the dependency has landed upstream,
> hence the "RFC"!
> ---
>  drivers/net/ethernet/renesas/sh_eth.c | 18 +++---------------
>  1 file changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index d2e88a30f57bb4c5..8ea4d0cc325baeca 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -40,7 +40,6 @@
>  #include <linux/slab.h>
>  #include <linux/ethtool.h>
>  #include <linux/if_vlan.h>
> -#include <linux/clk.h>
>  #include <linux/sh_eth.h>
>  #include <linux/of_mdio.h>
>  
> @@ -2293,7 +2292,7 @@ static void sh_eth_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
>  	wol->supported = 0;
>  	wol->wolopts = 0;
>  
> -	if (mdp->cd->magic && mdp->clk) {
> +	if (mdp->cd->magic) {
>  		wol->supported = WAKE_MAGIC;
>  		wol->wolopts = mdp->wol_enabled ? WAKE_MAGIC : 0;
>  	}
> @@ -2303,7 +2302,7 @@ static int sh_eth_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
>  {
>  	struct sh_eth_private *mdp = netdev_priv(ndev);
>  
> -	if (!mdp->cd->magic || !mdp->clk || wol->wolopts & ~WAKE_MAGIC)
> +	if (!mdp->cd->magic || wol->wolopts & ~WAKE_MAGIC)
>  		return -EOPNOTSUPP;
>  
>  	mdp->wol_enabled = !!(wol->wolopts & WAKE_MAGIC);
> @@ -3144,11 +3143,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
>  		goto out_release;
>  	}
>  
> -	/* Get clock, if not found that's OK but Wake-On-Lan is unavailable */
> -	mdp->clk = devm_clk_get(&pdev->dev, NULL);
> -	if (IS_ERR(mdp->clk))
> -		mdp->clk = NULL;
> -
>  	ndev->base_addr = res->start;
>  
>  	spin_lock_init(&mdp->lock);
> @@ -3251,7 +3245,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto out_napi_del;
>  
> -	if (mdp->cd->magic && mdp->clk)
> +	if (mdp->cd->magic)
>  		device_set_wakeup_capable(&pdev->dev, 1);
>  
>  	/* print device information */
> @@ -3305,9 +3299,6 @@ static int sh_eth_wol_setup(struct net_device *ndev)
>  	/* Enable MagicPacket */
>  	sh_eth_modify(ndev, ECMR, ECMR_MPDE, ECMR_MPDE);
>  
> -	/* Increased clock usage so device won't be suspended */
> -	clk_enable(mdp->clk);
> -
>  	return enable_irq_wake(ndev->irq);
>  }
>  
> @@ -3333,9 +3324,6 @@ static int sh_eth_wol_restore(struct net_device *ndev)
>  	if (ret < 0)
>  		return ret;
>  
> -	/* Restore clock usage count */
> -	clk_disable(mdp->clk);
> -
>  	return disable_irq_wake(ndev->irq);
>  }
>  
> -- 
> 2.7.4
>
Sergei Shtylyov Oct. 16, 2017, 7:24 p.m. UTC | #2
Hello!

On 10/16/2017 04:55 PM, Geert Uytterhoeven wrote:

> Currently, if Wake-on-LAN is enabled, the SH-ETH device's module clock

    It's called Ether (or GEther) in all the manuals I have. Never saw SH-ETH, 
I think it's Nobuhiro's invention... :-)

> is manually kept running during system suspend, to make sure the device
> stays active.
> 
> Since "soc: renesas: rcar-sysc: Keep wakeup sources active during system
> suspend" and "clk: renesas: mstp: Keep wakeup sources active during
> system suspend", this workaround is no longer needed.  Hence remove all
> explicit clock handling to keep the device active.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
[...]

Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

MBR, Sergei
diff mbox

Patch

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index d2e88a30f57bb4c5..8ea4d0cc325baeca 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -40,7 +40,6 @@ 
 #include <linux/slab.h>
 #include <linux/ethtool.h>
 #include <linux/if_vlan.h>
-#include <linux/clk.h>
 #include <linux/sh_eth.h>
 #include <linux/of_mdio.h>
 
@@ -2293,7 +2292,7 @@  static void sh_eth_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
 	wol->supported = 0;
 	wol->wolopts = 0;
 
-	if (mdp->cd->magic && mdp->clk) {
+	if (mdp->cd->magic) {
 		wol->supported = WAKE_MAGIC;
 		wol->wolopts = mdp->wol_enabled ? WAKE_MAGIC : 0;
 	}
@@ -2303,7 +2302,7 @@  static int sh_eth_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);
 
-	if (!mdp->cd->magic || !mdp->clk || wol->wolopts & ~WAKE_MAGIC)
+	if (!mdp->cd->magic || wol->wolopts & ~WAKE_MAGIC)
 		return -EOPNOTSUPP;
 
 	mdp->wol_enabled = !!(wol->wolopts & WAKE_MAGIC);
@@ -3144,11 +3143,6 @@  static int sh_eth_drv_probe(struct platform_device *pdev)
 		goto out_release;
 	}
 
-	/* Get clock, if not found that's OK but Wake-On-Lan is unavailable */
-	mdp->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(mdp->clk))
-		mdp->clk = NULL;
-
 	ndev->base_addr = res->start;
 
 	spin_lock_init(&mdp->lock);
@@ -3251,7 +3245,7 @@  static int sh_eth_drv_probe(struct platform_device *pdev)
 	if (ret)
 		goto out_napi_del;
 
-	if (mdp->cd->magic && mdp->clk)
+	if (mdp->cd->magic)
 		device_set_wakeup_capable(&pdev->dev, 1);
 
 	/* print device information */
@@ -3305,9 +3299,6 @@  static int sh_eth_wol_setup(struct net_device *ndev)
 	/* Enable MagicPacket */
 	sh_eth_modify(ndev, ECMR, ECMR_MPDE, ECMR_MPDE);
 
-	/* Increased clock usage so device won't be suspended */
-	clk_enable(mdp->clk);
-
 	return enable_irq_wake(ndev->irq);
 }
 
@@ -3333,9 +3324,6 @@  static int sh_eth_wol_restore(struct net_device *ndev)
 	if (ret < 0)
 		return ret;
 
-	/* Restore clock usage count */
-	clk_disable(mdp->clk);
-
 	return disable_irq_wake(ndev->irq);
 }