netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sh_eth: Fix power down vs. is_opened flag ordering
@ 2021-01-18 15:08 Geert Uytterhoeven
  2021-01-18 16:56 ` Sergei Shtylyov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2021-01-18 15:08 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller, Jakub Kicinski, Simon Horman
  Cc: netdev, linux-renesas-soc, linux-kernel, Geert Uytterhoeven

sh_eth_close() does a synchronous power down of the device before
marking it closed.  Revert the order, to make sure the device is never
marked opened while suspended.

While at it, use pm_runtime_put() instead of pm_runtime_put_sync(), as
there is no reason to do a synchronous power down.

Fixes: 7fa2955ff70ce453 ("sh_eth: Fix sleeping function called from invalid context")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/net/ethernet/renesas/sh_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 9b52d350e21a9f2b..590b088bc4c7f3e2 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2606,10 +2606,10 @@ static int sh_eth_close(struct net_device *ndev)
 	/* Free all the skbuffs in the Rx queue and the DMA buffer. */
 	sh_eth_ring_free(ndev);
 
-	pm_runtime_put_sync(&mdp->pdev->dev);
-
 	mdp->is_opened = 0;
 
+	pm_runtime_put(&mdp->pdev->dev);
+
 	return 0;
 }
 
-- 
2.25.1


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

* Re: [PATCH] sh_eth: Fix power down vs. is_opened flag ordering
  2021-01-18 15:08 [PATCH] sh_eth: Fix power down vs. is_opened flag ordering Geert Uytterhoeven
@ 2021-01-18 16:56 ` Sergei Shtylyov
  2021-01-18 20:50 ` Niklas Söderlund
  2021-01-20  0:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2021-01-18 16:56 UTC (permalink / raw)
  To: Geert Uytterhoeven, David S . Miller, Jakub Kicinski, Simon Horman
  Cc: netdev, linux-renesas-soc, linux-kernel

On 1/18/21 6:08 PM, Geert Uytterhoeven wrote:

> sh_eth_close() does a synchronous power down of the device before
> marking it closed.  Revert the order, to make sure the device is never
> marked opened while suspended.
> 
> While at it, use pm_runtime_put() instead of pm_runtime_put_sync(), as
> there is no reason to do a synchronous power down.
> 
> Fixes: 7fa2955ff70ce453 ("sh_eth: Fix sleeping function called from invalid context")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

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

[...]

MBR, Sergei

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

* Re: [PATCH] sh_eth: Fix power down vs. is_opened flag ordering
  2021-01-18 15:08 [PATCH] sh_eth: Fix power down vs. is_opened flag ordering Geert Uytterhoeven
  2021-01-18 16:56 ` Sergei Shtylyov
@ 2021-01-18 20:50 ` Niklas Söderlund
  2021-01-20  0:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Niklas Söderlund @ 2021-01-18 20:50 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Sergei Shtylyov, David S . Miller, Jakub Kicinski, Simon Horman,
	netdev, linux-renesas-soc, linux-kernel

Hi Geert,

Thanks for your work.

On 2021-01-18 16:08:12 +0100, Geert Uytterhoeven wrote:
> sh_eth_close() does a synchronous power down of the device before
> marking it closed.  Revert the order, to make sure the device is never
> marked opened while suspended.
> 
> While at it, use pm_runtime_put() instead of pm_runtime_put_sync(), as
> there is no reason to do a synchronous power down.
> 
> Fixes: 7fa2955ff70ce453 ("sh_eth: Fix sleeping function called from invalid context")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

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

> ---
>  drivers/net/ethernet/renesas/sh_eth.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 9b52d350e21a9f2b..590b088bc4c7f3e2 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -2606,10 +2606,10 @@ static int sh_eth_close(struct net_device *ndev)
>  	/* Free all the skbuffs in the Rx queue and the DMA buffer. */
>  	sh_eth_ring_free(ndev);
>  
> -	pm_runtime_put_sync(&mdp->pdev->dev);
> -
>  	mdp->is_opened = 0;
>  
> +	pm_runtime_put(&mdp->pdev->dev);
> +
>  	return 0;
>  }
>  
> -- 
> 2.25.1
> 

-- 
Regards,
Niklas Söderlund

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

* Re: [PATCH] sh_eth: Fix power down vs. is_opened flag ordering
  2021-01-18 15:08 [PATCH] sh_eth: Fix power down vs. is_opened flag ordering Geert Uytterhoeven
  2021-01-18 16:56 ` Sergei Shtylyov
  2021-01-18 20:50 ` Niklas Söderlund
@ 2021-01-20  0:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-01-20  0:50 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: sergei.shtylyov, davem, kuba, horms+renesas, netdev,
	linux-renesas-soc, linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Mon, 18 Jan 2021 16:08:12 +0100 you wrote:
> sh_eth_close() does a synchronous power down of the device before
> marking it closed.  Revert the order, to make sure the device is never
> marked opened while suspended.
> 
> While at it, use pm_runtime_put() instead of pm_runtime_put_sync(), as
> there is no reason to do a synchronous power down.
> 
> [...]

Here is the summary with links:
  - sh_eth: Fix power down vs. is_opened flag ordering
    https://git.kernel.org/netdev/net/c/f6a2e94b3f9d

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-01-20  0:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-18 15:08 [PATCH] sh_eth: Fix power down vs. is_opened flag ordering Geert Uytterhoeven
2021-01-18 16:56 ` Sergei Shtylyov
2021-01-18 20:50 ` Niklas Söderlund
2021-01-20  0:50 ` patchwork-bot+netdevbpf

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).