All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] patch for stmmac driver
@ 2021-02-04 10:15 Joakim Zhang
  2021-02-04 10:15 ` [PATCH net-next 1/2] net: stmmac: remove redundant null check for ptp clock Joakim Zhang
  2021-02-04 10:15 ` [PATCH net-next 2/2] net: stmmac: slightly adjust the order of the codes in stmmac_resume() Joakim Zhang
  0 siblings, 2 replies; 6+ messages in thread
From: Joakim Zhang @ 2021-02-04 10:15 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba
  Cc: netdev, andrew, f.fainelli, willemdebruijn.kernel

Small improvement for stmmac driver.

Reviewer think patch #1 should go into net-next repo, and add patch #2.

Joakim Zhang (2):
  net: stmmac: remove redundant null check for ptp clock
  net: stmmac: slightly adjust the order of the codes in stmmac_resume()

 .../net/ethernet/stmicro/stmmac/stmmac_main.c   | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

-- 
2.17.1


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

* [PATCH net-next 1/2] net: stmmac: remove redundant null check for ptp clock
  2021-02-04 10:15 [PATCH net-next 0/2] patch for stmmac driver Joakim Zhang
@ 2021-02-04 10:15 ` Joakim Zhang
  2021-02-04 10:15 ` [PATCH net-next 2/2] net: stmmac: slightly adjust the order of the codes in stmmac_resume() Joakim Zhang
  1 sibling, 0 replies; 6+ messages in thread
From: Joakim Zhang @ 2021-02-04 10:15 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba
  Cc: netdev, andrew, f.fainelli, willemdebruijn.kernel

commit 1c35cc9cf6a0 ("net: stmmac: remove redundant null check before
clk_disable_unprepare()"), have not did NULL clock parameter check completely,
this patch help remove redundant null check for ptp clock.

Fixes: 1c35cc9cf6a0 ("net: stmmac: remove redundant null check before clk_disable_unprepare()")
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 26b971cd4da5..11e0b30b2e01 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5291,8 +5291,7 @@ int stmmac_resume(struct device *dev)
 		/* enable the clk previously disabled */
 		clk_prepare_enable(priv->plat->stmmac_clk);
 		clk_prepare_enable(priv->plat->pclk);
-		if (priv->plat->clk_ptp_ref)
-			clk_prepare_enable(priv->plat->clk_ptp_ref);
+		clk_prepare_enable(priv->plat->clk_ptp_ref);
 		/* reset the phy so that it's ready */
 		if (priv->mii)
 			stmmac_mdio_reset(priv->mii);
-- 
2.17.1


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

* [PATCH net-next 2/2] net: stmmac: slightly adjust the order of the codes in stmmac_resume()
  2021-02-04 10:15 [PATCH net-next 0/2] patch for stmmac driver Joakim Zhang
  2021-02-04 10:15 ` [PATCH net-next 1/2] net: stmmac: remove redundant null check for ptp clock Joakim Zhang
@ 2021-02-04 10:15 ` Joakim Zhang
  2021-02-04 13:20   ` Willem de Bruijn
  1 sibling, 1 reply; 6+ messages in thread
From: Joakim Zhang @ 2021-02-04 10:15 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba
  Cc: netdev, andrew, f.fainelli, willemdebruijn.kernel

Slightly adjust the order of the codes in stmmac_resume(), remove the
check "if (!device_may_wakeup(priv->device) || !priv->plat->pmt)".

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 11e0b30b2e01..94d4f5d294f4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5295,6 +5295,12 @@ int stmmac_resume(struct device *dev)
 		/* reset the phy so that it's ready */
 		if (priv->mii)
 			stmmac_mdio_reset(priv->mii);
+
+		rtnl_lock();
+		phylink_start(priv->phylink);
+		/* We may have called phylink_speed_down before */
+		phylink_speed_up(priv->phylink);
+		rtnl_unlock();
 	}
 
 	if (priv->plat->serdes_powerup) {
@@ -5305,14 +5311,6 @@ int stmmac_resume(struct device *dev)
 			return ret;
 	}
 
-	if (!device_may_wakeup(priv->device) || !priv->plat->pmt) {
-		rtnl_lock();
-		phylink_start(priv->phylink);
-		/* We may have called phylink_speed_down before */
-		phylink_speed_up(priv->phylink);
-		rtnl_unlock();
-	}
-
 	rtnl_lock();
 	mutex_lock(&priv->lock);
 
-- 
2.17.1


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

* Re: [PATCH net-next 2/2] net: stmmac: slightly adjust the order of the codes in stmmac_resume()
  2021-02-04 10:15 ` [PATCH net-next 2/2] net: stmmac: slightly adjust the order of the codes in stmmac_resume() Joakim Zhang
@ 2021-02-04 13:20   ` Willem de Bruijn
  2021-02-05  1:18     ` Joakim Zhang
  0 siblings, 1 reply; 6+ messages in thread
From: Willem de Bruijn @ 2021-02-04 13:20 UTC (permalink / raw)
  To: Joakim Zhang
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, David Miller,
	Jakub Kicinski, Network Development, Andrew Lunn,
	Florian Fainelli, Willem de Bruijn

On Thu, Feb 4, 2021 at 5:18 AM Joakim Zhang <qiangqing.zhang@nxp.com> wrote:
>
> Slightly adjust the order of the codes in stmmac_resume(), remove the
> check "if (!device_may_wakeup(priv->device) || !priv->plat->pmt)".
>
> Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>

This commit message says what the code does, but not why or why it's correct.

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

* RE: [PATCH net-next 2/2] net: stmmac: slightly adjust the order of the codes in stmmac_resume()
  2021-02-04 13:20   ` Willem de Bruijn
@ 2021-02-05  1:18     ` Joakim Zhang
  2021-02-05 15:41       ` Willem de Bruijn
  0 siblings, 1 reply; 6+ messages in thread
From: Joakim Zhang @ 2021-02-05  1:18 UTC (permalink / raw)
  To: Willem de Bruijn
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, David Miller,
	Jakub Kicinski, Network Development, Andrew Lunn,
	Florian Fainelli


> -----Original Message-----
> From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Sent: 2021年2月4日 21:20
> To: Joakim Zhang <qiangqing.zhang@nxp.com>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre Torgue
> <alexandre.torgue@st.com>; Jose Abreu <joabreu@synopsys.com>; David
> Miller <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>; Network
> Development <netdev@vger.kernel.org>; Andrew Lunn <andrew@lunn.ch>;
> Florian Fainelli <f.fainelli@gmail.com>; Willem de Bruijn
> <willemdebruijn.kernel@gmail.com>
> Subject: Re: [PATCH net-next 2/2] net: stmmac: slightly adjust the order of the
> codes in stmmac_resume()
> 
> On Thu, Feb 4, 2021 at 5:18 AM Joakim Zhang <qiangqing.zhang@nxp.com>
> wrote:
> >
> > Slightly adjust the order of the codes in stmmac_resume(), remove the
> > check "if (!device_may_wakeup(priv->device) || !priv->plat->pmt)".
> >
> > Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
> 
> This commit message says what the code does, but not why or why it's correct.

This just slight changes the code order, there is no function change, I will improve the commit message if needed.

Best Regards,
Joakim Zhang

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

* Re: [PATCH net-next 2/2] net: stmmac: slightly adjust the order of the codes in stmmac_resume()
  2021-02-05  1:18     ` Joakim Zhang
@ 2021-02-05 15:41       ` Willem de Bruijn
  0 siblings, 0 replies; 6+ messages in thread
From: Willem de Bruijn @ 2021-02-05 15:41 UTC (permalink / raw)
  To: Joakim Zhang
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, David Miller,
	Jakub Kicinski, Network Development, Andrew Lunn,
	Florian Fainelli

On Thu, Feb 4, 2021 at 8:18 PM Joakim Zhang <qiangqing.zhang@nxp.com> wrote:
>
>
> > -----Original Message-----
> > From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> > Sent: 2021年2月4日 21:20
> > To: Joakim Zhang <qiangqing.zhang@nxp.com>
> > Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre Torgue
> > <alexandre.torgue@st.com>; Jose Abreu <joabreu@synopsys.com>; David
> > Miller <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>; Network
> > Development <netdev@vger.kernel.org>; Andrew Lunn <andrew@lunn.ch>;
> > Florian Fainelli <f.fainelli@gmail.com>; Willem de Bruijn
> > <willemdebruijn.kernel@gmail.com>
> > Subject: Re: [PATCH net-next 2/2] net: stmmac: slightly adjust the order of the
> > codes in stmmac_resume()
> >
> > On Thu, Feb 4, 2021 at 5:18 AM Joakim Zhang <qiangqing.zhang@nxp.com>
> > wrote:
> > >
> > > Slightly adjust the order of the codes in stmmac_resume(), remove the
> > > check "if (!device_may_wakeup(priv->device) || !priv->plat->pmt)".
> > >
> > > Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
> >
> > This commit message says what the code does, but not why or why it's correct.
>
> This just slight changes the code order, there is no function change, I will improve the commit message if needed.

And it is correct to move this phylink initialization before serdes_powerup?

That is not immediately obvious to me. A comment would definitely be
good. More relevant than just stating that the code is moved, which I
see from the patch easily.

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

end of thread, other threads:[~2021-02-05 16:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 10:15 [PATCH net-next 0/2] patch for stmmac driver Joakim Zhang
2021-02-04 10:15 ` [PATCH net-next 1/2] net: stmmac: remove redundant null check for ptp clock Joakim Zhang
2021-02-04 10:15 ` [PATCH net-next 2/2] net: stmmac: slightly adjust the order of the codes in stmmac_resume() Joakim Zhang
2021-02-04 13:20   ` Willem de Bruijn
2021-02-05  1:18     ` Joakim Zhang
2021-02-05 15:41       ` Willem de Bruijn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.