linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: dwmac-sun8i: Use reset exclusive
@ 2017-08-25 14:38 Corentin Labbe
  2017-08-25 14:48 ` Maxime Ripard
  0 siblings, 1 reply; 5+ messages in thread
From: Corentin Labbe @ 2017-08-25 14:38 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, maxime.ripard, wens
  Cc: netdev, linux-arm-kernel, linux-kernel, Corentin Labbe

The current dwmac_sun8i module cannot be rmmod/modprobe due to that
the reset controller was not released when removed.

This patch remove ambiguity, by using of_reset_control_get_exclusive and
add the missing reset_control_put().

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index fffd6d5fc907..675a09629d85 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -782,6 +782,7 @@ static int sun8i_dwmac_unpower_internal_phy(struct sunxi_priv_data *gmac)
 
 	clk_disable_unprepare(gmac->ephy_clk);
 	reset_control_assert(gmac->rst_ephy);
+	reset_control_put(gmac->rst_ephy);
 	return 0;
 }
 
@@ -942,7 +943,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
 			return -EINVAL;
 		}
 
-		gmac->rst_ephy = of_reset_control_get(plat_dat->phy_node, NULL);
+		gmac->rst_ephy = of_reset_control_get_exclusive(plat_dat->phy_node, NULL);
 		if (IS_ERR(gmac->rst_ephy)) {
 			ret = PTR_ERR(gmac->rst_ephy);
 			if (ret == -EPROBE_DEFER)
-- 
2.13.5

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

* Re: [PATCH] net: stmmac: dwmac-sun8i: Use reset exclusive
  2017-08-25 14:38 [PATCH] net: stmmac: dwmac-sun8i: Use reset exclusive Corentin Labbe
@ 2017-08-25 14:48 ` Maxime Ripard
  2017-08-25 15:17   ` Corentin Labbe
  0 siblings, 1 reply; 5+ messages in thread
From: Maxime Ripard @ 2017-08-25 14:48 UTC (permalink / raw)
  To: Corentin Labbe
  Cc: peppe.cavallaro, alexandre.torgue, wens, netdev,
	linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1462 bytes --]

On Fri, Aug 25, 2017 at 04:38:05PM +0200, Corentin Labbe wrote:
> The current dwmac_sun8i module cannot be rmmod/modprobe due to that
> the reset controller was not released when removed.
> 
> This patch remove ambiguity, by using of_reset_control_get_exclusive and
> add the missing reset_control_put().
> 
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> index fffd6d5fc907..675a09629d85 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> @@ -782,6 +782,7 @@ static int sun8i_dwmac_unpower_internal_phy(struct sunxi_priv_data *gmac)
>  
>  	clk_disable_unprepare(gmac->ephy_clk);
>  	reset_control_assert(gmac->rst_ephy);
> +	reset_control_put(gmac->rst_ephy);
>  	return 0;
>  }
>  
> @@ -942,7 +943,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
>  			return -EINVAL;
>  		}
>  
> -		gmac->rst_ephy = of_reset_control_get(plat_dat->phy_node, NULL);
> +		gmac->rst_ephy = of_reset_control_get_exclusive(plat_dat->phy_node, NULL);

Why not just use devm_reset_control_get?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

* Re: [PATCH] net: stmmac: dwmac-sun8i: Use reset exclusive
  2017-08-25 14:48 ` Maxime Ripard
@ 2017-08-25 15:17   ` Corentin Labbe
  2017-08-25 17:12     ` Maxime Ripard
  0 siblings, 1 reply; 5+ messages in thread
From: Corentin Labbe @ 2017-08-25 15:17 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: peppe.cavallaro, alexandre.torgue, wens, netdev,
	linux-arm-kernel, linux-kernel

On Fri, Aug 25, 2017 at 04:48:32PM +0200, Maxime Ripard wrote:
> On Fri, Aug 25, 2017 at 04:38:05PM +0200, Corentin Labbe wrote:
> > The current dwmac_sun8i module cannot be rmmod/modprobe due to that
> > the reset controller was not released when removed.
> > 
> > This patch remove ambiguity, by using of_reset_control_get_exclusive and
> > add the missing reset_control_put().
> > 
> > Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> > ---
> >  drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> > index fffd6d5fc907..675a09629d85 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> > @@ -782,6 +782,7 @@ static int sun8i_dwmac_unpower_internal_phy(struct sunxi_priv_data *gmac)
> >  
> >  	clk_disable_unprepare(gmac->ephy_clk);
> >  	reset_control_assert(gmac->rst_ephy);
> > +	reset_control_put(gmac->rst_ephy);
> >  	return 0;
> >  }
> >  
> > @@ -942,7 +943,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
> >  			return -EINVAL;
> >  		}
> >  
> > -		gmac->rst_ephy = of_reset_control_get(plat_dat->phy_node, NULL);
> > +		gmac->rst_ephy = of_reset_control_get_exclusive(plat_dat->phy_node, NULL);
> 
> Why not just use devm_reset_control_get?
> 

Because there no devm_ functions with of_

Regards

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

* Re: [PATCH] net: stmmac: dwmac-sun8i: Use reset exclusive
  2017-08-25 15:17   ` Corentin Labbe
@ 2017-08-25 17:12     ` Maxime Ripard
  2017-08-30 10:21       ` Corentin Labbe
  0 siblings, 1 reply; 5+ messages in thread
From: Maxime Ripard @ 2017-08-25 17:12 UTC (permalink / raw)
  To: Corentin Labbe
  Cc: peppe.cavallaro, alexandre.torgue, wens, netdev,
	linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1840 bytes --]

On Fri, Aug 25, 2017 at 05:17:33PM +0200, Corentin Labbe wrote:
> On Fri, Aug 25, 2017 at 04:48:32PM +0200, Maxime Ripard wrote:
> > On Fri, Aug 25, 2017 at 04:38:05PM +0200, Corentin Labbe wrote:
> > > The current dwmac_sun8i module cannot be rmmod/modprobe due to that
> > > the reset controller was not released when removed.
> > > 
> > > This patch remove ambiguity, by using of_reset_control_get_exclusive and
> > > add the missing reset_control_put().
> > > 
> > > Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> > > ---
> > >  drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> > > index fffd6d5fc907..675a09629d85 100644
> > > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> > > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> > > @@ -782,6 +782,7 @@ static int sun8i_dwmac_unpower_internal_phy(struct sunxi_priv_data *gmac)
> > >  
> > >  	clk_disable_unprepare(gmac->ephy_clk);
> > >  	reset_control_assert(gmac->rst_ephy);
> > > +	reset_control_put(gmac->rst_ephy);
> > >  	return 0;
> > >  }
> > >  
> > > @@ -942,7 +943,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
> > >  			return -EINVAL;
> > >  		}
> > >  
> > > -		gmac->rst_ephy = of_reset_control_get(plat_dat->phy_node, NULL);
> > > +		gmac->rst_ephy = of_reset_control_get_exclusive(plat_dat->phy_node, NULL);
> > 
> > Why not just use devm_reset_control_get?
> > 
> 
> Because there no devm_ functions with of_

devm_reset_control_get uses of_reset_control_get internally.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

* Re: [PATCH] net: stmmac: dwmac-sun8i: Use reset exclusive
  2017-08-25 17:12     ` Maxime Ripard
@ 2017-08-30 10:21       ` Corentin Labbe
  0 siblings, 0 replies; 5+ messages in thread
From: Corentin Labbe @ 2017-08-30 10:21 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: peppe.cavallaro, alexandre.torgue, wens, netdev,
	linux-arm-kernel, linux-kernel

On Fri, Aug 25, 2017 at 07:12:33PM +0200, Maxime Ripard wrote:
> On Fri, Aug 25, 2017 at 05:17:33PM +0200, Corentin Labbe wrote:
> > On Fri, Aug 25, 2017 at 04:48:32PM +0200, Maxime Ripard wrote:
> > > On Fri, Aug 25, 2017 at 04:38:05PM +0200, Corentin Labbe wrote:
> > > > The current dwmac_sun8i module cannot be rmmod/modprobe due to that
> > > > the reset controller was not released when removed.
> > > > 
> > > > This patch remove ambiguity, by using of_reset_control_get_exclusive and
> > > > add the missing reset_control_put().
> > > > 
> > > > Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> > > > ---
> > > >  drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 3 ++-
> > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> > > > index fffd6d5fc907..675a09629d85 100644
> > > > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> > > > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> > > > @@ -782,6 +782,7 @@ static int sun8i_dwmac_unpower_internal_phy(struct sunxi_priv_data *gmac)
> > > >  
> > > >  	clk_disable_unprepare(gmac->ephy_clk);
> > > >  	reset_control_assert(gmac->rst_ephy);
> > > > +	reset_control_put(gmac->rst_ephy);
> > > >  	return 0;
> > > >  }
> > > >  
> > > > @@ -942,7 +943,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
> > > >  			return -EINVAL;
> > > >  		}
> > > >  
> > > > -		gmac->rst_ephy = of_reset_control_get(plat_dat->phy_node, NULL);
> > > > +		gmac->rst_ephy = of_reset_control_get_exclusive(plat_dat->phy_node, NULL);
> > > 
> > > Why not just use devm_reset_control_get?
> > > 
> > 
> > Because there no devm_ functions with of_
> 
> devm_reset_control_get uses of_reset_control_get internally.

Hello

You are right.
But since the ephy reset is in a child node, devm_ does not find it.

Regards

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

end of thread, other threads:[~2017-08-30 10:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-25 14:38 [PATCH] net: stmmac: dwmac-sun8i: Use reset exclusive Corentin Labbe
2017-08-25 14:48 ` Maxime Ripard
2017-08-25 15:17   ` Corentin Labbe
2017-08-25 17:12     ` Maxime Ripard
2017-08-30 10:21       ` Corentin Labbe

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