linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/5] net: stmmac: cleanups
@ 2024-05-28 11:48 Russell King (Oracle)
  2024-05-28 11:48 ` [PATCH net-next 1/5] net: stmmac: Drop TBI/RTBI PCS flags Russell King
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Russell King (Oracle) @ 2024-05-28 11:48 UTC (permalink / raw)
  To: Serge Semin
  Cc: Alexandre Torgue, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Jose Abreu, linux-arm-kernel, linux-stm32, Maxime Coquelin,
	netdev, Paolo Abeni

Hi,

This series removes various redundant items in the stmmac driver:

- the unused TBI and RTBI PCS flags
- the NULL pointer initialisations for PCS methods in dwxgmac2
- the stmmac_pcs_rane() method which is never called, and it's
  associated implementations
- the redundant netif_carrier_off()s

Finally, it replaces asm/io.h with the preferred linux/io.h.

 drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c |  8 +-------
 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c    |  8 --------
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c  |  6 ------
 drivers/net/ethernet/stmicro/stmmac/hwif.h           |  3 ---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c    |  8 +-------
 drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h     | 17 -----------------
 6 files changed, 2 insertions(+), 48 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next 1/5] net: stmmac: Drop TBI/RTBI PCS flags
  2024-05-28 11:48 [PATCH net-next 0/5] net: stmmac: cleanups Russell King (Oracle)
@ 2024-05-28 11:48 ` Russell King
  2024-05-28 12:26   ` Serge Semin
  2024-05-28 11:48 ` [PATCH net-next 2/5] net: stmmac: dwxgmac2: remove useless NULL pointer initialisations Russell King (Oracle)
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Russell King @ 2024-05-28 11:48 UTC (permalink / raw)
  To: Serge Semin
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, netdev, linux-stm32,
	linux-arm-kernel

From: Serge Semin <fancer.lancer@gmail.com>

First of all the flags are never set by any of the driver parts. If nobody
have them set then the respective statements will always have the same
result. Thus the statements can be simplified or even dropped with no risk
to break things.

Secondly shall any of the TBI or RTBI flag is set the MDIO-bus
registration will be bypassed. Why? It really seems weird. It's perfectly
fine to have a TBI/RTBI-capable PHY configured over the MDIO bus
interface.

Based on the notes above the TBI/RTBI PCS flags can be freely dropped thus
simplifying the driver code.

Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b3afc7cb7d72..e01340034d50 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7833,10 +7833,7 @@ void stmmac_dvr_remove(struct device *dev)
 	reset_control_assert(priv->plat->stmmac_ahb_rst);
 
 	stmmac_pcs_clean(ndev);
-
-	if (priv->hw->pcs != STMMAC_PCS_TBI &&
-	    priv->hw->pcs != STMMAC_PCS_RTBI)
-		stmmac_mdio_unregister(ndev);
+	stmmac_mdio_unregister(ndev);
 	destroy_workqueue(priv->wq);
 	mutex_destroy(&priv->lock);
 	bitmap_free(priv->af_xdp_zc_qps);
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next 2/5] net: stmmac: dwxgmac2: remove useless NULL pointer initialisations
  2024-05-28 11:48 [PATCH net-next 0/5] net: stmmac: cleanups Russell King (Oracle)
  2024-05-28 11:48 ` [PATCH net-next 1/5] net: stmmac: Drop TBI/RTBI PCS flags Russell King
@ 2024-05-28 11:48 ` Russell King (Oracle)
  2024-05-28 20:39   ` Andrew Halaney
  2024-05-28 11:48 ` [PATCH net-next 3/5] net: stmmac: remove pcs_rane() method Russell King (Oracle)
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Russell King (Oracle) @ 2024-05-28 11:48 UTC (permalink / raw)
  To: Serge Semin
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, netdev, linux-stm32,
	linux-arm-kernel

Remove useless NULL pointer initialisations for "PCS" methods from the
dwxgmac2 code.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
index f8e7775bb633..6a987cf598e4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
@@ -1554,9 +1554,6 @@ const struct stmmac_ops dwxgmac210_ops = {
 	.reset_eee_mode = dwxgmac2_reset_eee_mode,
 	.set_eee_timer = dwxgmac2_set_eee_timer,
 	.set_eee_pls = dwxgmac2_set_eee_pls,
-	.pcs_ctrl_ane = NULL,
-	.pcs_rane = NULL,
-	.pcs_get_adv_lp = NULL,
 	.debug = NULL,
 	.set_filter = dwxgmac2_set_filter,
 	.safety_feat_config = dwxgmac3_safety_feat_config,
@@ -1614,9 +1611,6 @@ const struct stmmac_ops dwxlgmac2_ops = {
 	.reset_eee_mode = dwxgmac2_reset_eee_mode,
 	.set_eee_timer = dwxgmac2_set_eee_timer,
 	.set_eee_pls = dwxgmac2_set_eee_pls,
-	.pcs_ctrl_ane = NULL,
-	.pcs_rane = NULL,
-	.pcs_get_adv_lp = NULL,
 	.debug = NULL,
 	.set_filter = dwxgmac2_set_filter,
 	.safety_feat_config = dwxgmac3_safety_feat_config,
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next 3/5] net: stmmac: remove pcs_rane() method
  2024-05-28 11:48 [PATCH net-next 0/5] net: stmmac: cleanups Russell King (Oracle)
  2024-05-28 11:48 ` [PATCH net-next 1/5] net: stmmac: Drop TBI/RTBI PCS flags Russell King
  2024-05-28 11:48 ` [PATCH net-next 2/5] net: stmmac: dwxgmac2: remove useless NULL pointer initialisations Russell King (Oracle)
@ 2024-05-28 11:48 ` Russell King (Oracle)
  2024-05-28 20:40   ` Andrew Halaney
  2024-05-28 11:48 ` [PATCH net-next 4/5] net: stmmac: remove unnecessary netif_carrier_off() Russell King (Oracle)
  2024-05-28 11:48 ` [PATCH net-next 5/5] net: stmmac: include linux/io.h rather than asm/io.h Russell King (Oracle)
  4 siblings, 1 reply; 13+ messages in thread
From: Russell King (Oracle) @ 2024-05-28 11:48 UTC (permalink / raw)
  To: Serge Semin
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, netdev, linux-stm32,
	linux-arm-kernel

The pcs_rane() method is not called, so lets just remove this
redundant code.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 .../ethernet/stmicro/stmmac/dwmac1000_core.c    |  6 ------
 .../net/ethernet/stmicro/stmmac/dwmac4_core.c   |  8 --------
 drivers/net/ethernet/stmicro/stmmac/hwif.h      |  3 ---
 .../net/ethernet/stmicro/stmmac/stmmac_pcs.h    | 17 -----------------
 4 files changed, 34 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index 8555299443f4..d0c7c2320d8d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -404,11 +404,6 @@ static void dwmac1000_ctrl_ane(void __iomem *ioaddr, bool ane, bool srgmi_ral,
 	dwmac_ctrl_ane(ioaddr, GMAC_PCS_BASE, ane, srgmi_ral, loopback);
 }
 
-static void dwmac1000_rane(void __iomem *ioaddr, bool restart)
-{
-	dwmac_rane(ioaddr, GMAC_PCS_BASE, restart);
-}
-
 static void dwmac1000_get_adv_lp(void __iomem *ioaddr, struct rgmii_adv *adv)
 {
 	dwmac_get_adv_lp(ioaddr, GMAC_PCS_BASE, adv);
@@ -519,7 +514,6 @@ const struct stmmac_ops dwmac1000_ops = {
 	.set_eee_pls = dwmac1000_set_eee_pls,
 	.debug = dwmac1000_debug,
 	.pcs_ctrl_ane = dwmac1000_ctrl_ane,
-	.pcs_rane = dwmac1000_rane,
 	.pcs_get_adv_lp = dwmac1000_get_adv_lp,
 	.set_mac_loopback = dwmac1000_set_mac_loopback,
 };
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index b25774d69195..dbd9f93b2460 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -758,11 +758,6 @@ static void dwmac4_ctrl_ane(void __iomem *ioaddr, bool ane, bool srgmi_ral,
 	dwmac_ctrl_ane(ioaddr, GMAC_PCS_BASE, ane, srgmi_ral, loopback);
 }
 
-static void dwmac4_rane(void __iomem *ioaddr, bool restart)
-{
-	dwmac_rane(ioaddr, GMAC_PCS_BASE, restart);
-}
-
 static void dwmac4_get_adv_lp(void __iomem *ioaddr, struct rgmii_adv *adv)
 {
 	dwmac_get_adv_lp(ioaddr, GMAC_PCS_BASE, adv);
@@ -1215,7 +1210,6 @@ const struct stmmac_ops dwmac4_ops = {
 	.set_eee_timer = dwmac4_set_eee_timer,
 	.set_eee_pls = dwmac4_set_eee_pls,
 	.pcs_ctrl_ane = dwmac4_ctrl_ane,
-	.pcs_rane = dwmac4_rane,
 	.pcs_get_adv_lp = dwmac4_get_adv_lp,
 	.debug = dwmac4_debug,
 	.set_filter = dwmac4_set_filter,
@@ -1260,7 +1254,6 @@ const struct stmmac_ops dwmac410_ops = {
 	.set_eee_timer = dwmac4_set_eee_timer,
 	.set_eee_pls = dwmac4_set_eee_pls,
 	.pcs_ctrl_ane = dwmac4_ctrl_ane,
-	.pcs_rane = dwmac4_rane,
 	.pcs_get_adv_lp = dwmac4_get_adv_lp,
 	.debug = dwmac4_debug,
 	.set_filter = dwmac4_set_filter,
@@ -1309,7 +1302,6 @@ const struct stmmac_ops dwmac510_ops = {
 	.set_eee_timer = dwmac4_set_eee_timer,
 	.set_eee_pls = dwmac4_set_eee_pls,
 	.pcs_ctrl_ane = dwmac4_ctrl_ane,
-	.pcs_rane = dwmac4_rane,
 	.pcs_get_adv_lp = dwmac4_get_adv_lp,
 	.debug = dwmac4_debug,
 	.set_filter = dwmac4_set_filter,
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h
index 90384db228b5..97934ccba5b1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
@@ -370,7 +370,6 @@ struct stmmac_ops {
 	/* PCS calls */
 	void (*pcs_ctrl_ane)(void __iomem *ioaddr, bool ane, bool srgmi_ral,
 			     bool loopback);
-	void (*pcs_rane)(void __iomem *ioaddr, bool restart);
 	void (*pcs_get_adv_lp)(void __iomem *ioaddr, struct rgmii_adv *adv);
 	/* Safety Features */
 	int (*safety_feat_config)(void __iomem *ioaddr, unsigned int asp,
@@ -484,8 +483,6 @@ struct stmmac_ops {
 	stmmac_do_void_callback(__priv, mac, debug, __priv, __args)
 #define stmmac_pcs_ctrl_ane(__priv, __args...) \
 	stmmac_do_void_callback(__priv, mac, pcs_ctrl_ane, __args)
-#define stmmac_pcs_rane(__priv, __args...) \
-	stmmac_do_void_callback(__priv, mac, pcs_rane, __priv, __args)
 #define stmmac_pcs_get_adv_lp(__priv, __args...) \
 	stmmac_do_void_callback(__priv, mac, pcs_get_adv_lp, __args)
 #define stmmac_safety_feat_config(__priv, __args...) \
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
index 13a30e6df4c1..1bdf87b237c4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
@@ -74,23 +74,6 @@ static inline void dwmac_pcs_isr(void __iomem *ioaddr, u32 reg,
 	}
 }
 
-/**
- * dwmac_rane - To restart ANE
- * @ioaddr: IO registers pointer
- * @reg: Base address of the AN Control Register.
- * @restart: to restart ANE
- * Description: this is to just restart the Auto-Negotiation.
- */
-static inline void dwmac_rane(void __iomem *ioaddr, u32 reg, bool restart)
-{
-	u32 value = readl(ioaddr + GMAC_AN_CTRL(reg));
-
-	if (restart)
-		value |= GMAC_AN_CTRL_RAN;
-
-	writel(value, ioaddr + GMAC_AN_CTRL(reg));
-}
-
 /**
  * dwmac_ctrl_ane - To program the AN Control Register.
  * @ioaddr: IO registers pointer
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next 4/5] net: stmmac: remove unnecessary netif_carrier_off()
  2024-05-28 11:48 [PATCH net-next 0/5] net: stmmac: cleanups Russell King (Oracle)
                   ` (2 preceding siblings ...)
  2024-05-28 11:48 ` [PATCH net-next 3/5] net: stmmac: remove pcs_rane() method Russell King (Oracle)
@ 2024-05-28 11:48 ` Russell King (Oracle)
  2024-05-28 20:41   ` Andrew Halaney
  2024-05-28 11:48 ` [PATCH net-next 5/5] net: stmmac: include linux/io.h rather than asm/io.h Russell King (Oracle)
  4 siblings, 1 reply; 13+ messages in thread
From: Russell King (Oracle) @ 2024-05-28 11:48 UTC (permalink / raw)
  To: Serge Semin
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, netdev, linux-stm32,
	linux-arm-kernel

It is incorrect to call netif_carrier_off(), or in fact any driver
teardown, before unregister_netdev() has been called.

unregister_netdev() unpublishes the network device from userspace, and
takes the interface down if it was up prior to returning. Therefore,
once the call has returned, we are guaranteed that .ndo_stop() will
have been called for an interface that was up. Phylink will take the
carrier down via phylink_stop(), making any manipulation of the carrier
in the remove path unnecessary.

In the stmmac_release() path, the netif_carrier_off() call follows the
call to phylink_stop(), so this call is redundant.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e01340034d50..6e427ed7af05 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4097,8 +4097,6 @@ static int stmmac_release(struct net_device *dev)
 	if (priv->plat->serdes_powerdown)
 		priv->plat->serdes_powerdown(dev, priv->plat->bsp_priv);
 
-	netif_carrier_off(dev);
-
 	stmmac_release_ptp(priv);
 
 	pm_runtime_put(priv->device);
@@ -7821,7 +7819,6 @@ void stmmac_dvr_remove(struct device *dev)
 
 	stmmac_stop_all_dma(priv);
 	stmmac_mac_set(priv, priv->ioaddr, false);
-	netif_carrier_off(ndev);
 	unregister_netdev(ndev);
 
 #ifdef CONFIG_DEBUG_FS
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next 5/5] net: stmmac: include linux/io.h rather than asm/io.h
  2024-05-28 11:48 [PATCH net-next 0/5] net: stmmac: cleanups Russell King (Oracle)
                   ` (3 preceding siblings ...)
  2024-05-28 11:48 ` [PATCH net-next 4/5] net: stmmac: remove unnecessary netif_carrier_off() Russell King (Oracle)
@ 2024-05-28 11:48 ` Russell King (Oracle)
  2024-05-28 20:48   ` Andrew Halaney
  4 siblings, 1 reply; 13+ messages in thread
From: Russell King (Oracle) @ 2024-05-28 11:48 UTC (permalink / raw)
  To: Serge Semin
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, netdev, linux-stm32,
	linux-arm-kernel

Include linux/io.h instead of asm/io.h since linux/ includes are
preferred.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index d0c7c2320d8d..d413d76a8936 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -15,7 +15,7 @@
 #include <linux/crc32.h>
 #include <linux/slab.h>
 #include <linux/ethtool.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include "stmmac.h"
 #include "stmmac_pcs.h"
 #include "dwmac1000.h"
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next 1/5] net: stmmac: Drop TBI/RTBI PCS flags
  2024-05-28 11:48 ` [PATCH net-next 1/5] net: stmmac: Drop TBI/RTBI PCS flags Russell King
@ 2024-05-28 12:26   ` Serge Semin
  2024-05-28 13:20     ` Russell King (Oracle)
  0 siblings, 1 reply; 13+ messages in thread
From: Serge Semin @ 2024-05-28 12:26 UTC (permalink / raw)
  To: Russell King
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, netdev, linux-stm32,
	linux-arm-kernel

On Tue, May 28, 2024 at 12:48:37PM +0100, Russell King wrote:
> From: Serge Semin <fancer.lancer@gmail.com>
> 
> First of all the flags are never set by any of the driver parts. If nobody
> have them set then the respective statements will always have the same
> result. Thus the statements can be simplified or even dropped with no risk
> to break things.
> 
> Secondly shall any of the TBI or RTBI flag is set the MDIO-bus
> registration will be bypassed. Why? It really seems weird. It's perfectly
> fine to have a TBI/RTBI-capable PHY configured over the MDIO bus
> interface.
> 
> Based on the notes above the TBI/RTBI PCS flags can be freely dropped thus
> simplifying the driver code.

Likely by mistake the vast majority of the original patch content has
been missing here:
https://lore.kernel.org/netdev/20240524210304.9164-3-fancer.lancer@gmail.com/

-Serge(y)

> 
> Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index b3afc7cb7d72..e01340034d50 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -7833,10 +7833,7 @@ void stmmac_dvr_remove(struct device *dev)
>  	reset_control_assert(priv->plat->stmmac_ahb_rst);
>  
>  	stmmac_pcs_clean(ndev);
> -
> -	if (priv->hw->pcs != STMMAC_PCS_TBI &&
> -	    priv->hw->pcs != STMMAC_PCS_RTBI)
> -		stmmac_mdio_unregister(ndev);
> +	stmmac_mdio_unregister(ndev);
>  	destroy_workqueue(priv->wq);
>  	mutex_destroy(&priv->lock);
>  	bitmap_free(priv->af_xdp_zc_qps);
> -- 
> 2.30.2
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next 1/5] net: stmmac: Drop TBI/RTBI PCS flags
  2024-05-28 12:26   ` Serge Semin
@ 2024-05-28 13:20     ` Russell King (Oracle)
  2024-05-28 20:38       ` Andrew Halaney
  0 siblings, 1 reply; 13+ messages in thread
From: Russell King (Oracle) @ 2024-05-28 13:20 UTC (permalink / raw)
  To: Serge Semin
  Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, netdev, linux-stm32,
	linux-arm-kernel

On Tue, May 28, 2024 at 03:26:10PM +0300, Serge Semin wrote:
> On Tue, May 28, 2024 at 12:48:37PM +0100, Russell King wrote:
> > From: Serge Semin <fancer.lancer@gmail.com>
> > 
> > First of all the flags are never set by any of the driver parts. If nobody
> > have them set then the respective statements will always have the same
> > result. Thus the statements can be simplified or even dropped with no risk
> > to break things.
> > 
> > Secondly shall any of the TBI or RTBI flag is set the MDIO-bus
> > registration will be bypassed. Why? It really seems weird. It's perfectly
> > fine to have a TBI/RTBI-capable PHY configured over the MDIO bus
> > interface.
> > 
> > Based on the notes above the TBI/RTBI PCS flags can be freely dropped thus
> > simplifying the driver code.
> 
> Likely by mistake the vast majority of the original patch content has
> been missing here:
> https://lore.kernel.org/netdev/20240524210304.9164-3-fancer.lancer@gmail.com/

I really can't explain this, other than git doing something weird. There
is no reason that just one hunk that conflicted from a patch would've
appeared. Should've been as per the below, which it will be when I post
v2. Thanks for spotting!

8<===
From: Serge Semin <fancer.lancer@gmail.com>
Subject: [PATCH net-next] net: stmmac: Drop TBI/RTBI PCS flags

First of all the flags are never set by any of the driver parts. If nobody
have them set then the respective statements will always have the same
result. Thus the statements can be simplified or even dropped with no risk
to break things.

Secondly shall any of the TBI or RTBI flag is set the MDIO-bus
registration will be bypassed. Why? It really seems weird. It's perfectly
fine to have a TBI/RTBI-capable PHY configured over the MDIO bus
interface.

Based on the notes above the TBI/RTBI PCS flags can be freely dropped thus
simplifying the driver code.

Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/common.h  |  2 --
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 35 +++++--------------
 2 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 9cd62b2110a1..cd36ff4da68c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -271,8 +271,6 @@ struct stmmac_safety_stats {
 /* PCS defines */
 #define STMMAC_PCS_RGMII	(1 << 0)
 #define STMMAC_PCS_SGMII	(1 << 1)
-#define STMMAC_PCS_TBI		(1 << 2)
-#define STMMAC_PCS_RTBI		(1 << 3)
 
 #define SF_DMA_MODE 1		/* DMA STORE-AND-FORWARD Operation Mode */
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b3afc7cb7d72..3ab93f89be90 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -471,13 +471,6 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
 {
 	int eee_tw_timer = priv->eee_tw_timer;
 
-	/* Using PCS we cannot dial with the phy registers at this stage
-	 * so we do not support extra feature like EEE.
-	 */
-	if (priv->hw->pcs == STMMAC_PCS_TBI ||
-	    priv->hw->pcs == STMMAC_PCS_RTBI)
-		return false;
-
 	/* Check if MAC core supports the EEE feature. */
 	if (!priv->dma_cap.eee)
 		return false;
@@ -3953,9 +3946,7 @@ static int __stmmac_open(struct net_device *dev,
 	if (ret < 0)
 		return ret;
 
-	if (priv->hw->pcs != STMMAC_PCS_TBI &&
-	    priv->hw->pcs != STMMAC_PCS_RTBI &&
-	    (!priv->hw->xpcs ||
+	if ((!priv->hw->xpcs ||
 	     xpcs_get_an_mode(priv->hw->xpcs, mode) != DW_AN_C73)) {
 		ret = stmmac_init_phy(dev);
 		if (ret) {
@@ -7739,16 +7730,12 @@ int stmmac_dvr_probe(struct device *device,
 	if (!pm_runtime_enabled(device))
 		pm_runtime_enable(device);
 
-	if (priv->hw->pcs != STMMAC_PCS_TBI &&
-	    priv->hw->pcs != STMMAC_PCS_RTBI) {
-		/* MDIO bus Registration */
-		ret = stmmac_mdio_register(ndev);
-		if (ret < 0) {
-			dev_err_probe(priv->device, ret,
-				      "%s: MDIO bus (id: %d) registration failed\n",
-				      __func__, priv->plat->bus_id);
-			goto error_mdio_register;
-		}
+	ret = stmmac_mdio_register(ndev);
+	if (ret < 0) {
+		dev_err_probe(priv->device, ret,
+			      "MDIO bus (id: %d) registration failed\n",
+			      priv->plat->bus_id);
+		goto error_mdio_register;
 	}
 
 	if (priv->plat->speed_mode_2500)
@@ -7790,9 +7777,7 @@ int stmmac_dvr_probe(struct device *device,
 error_phy_setup:
 	stmmac_pcs_clean(ndev);
 error_pcs_setup:
-	if (priv->hw->pcs != STMMAC_PCS_TBI &&
-	    priv->hw->pcs != STMMAC_PCS_RTBI)
-		stmmac_mdio_unregister(ndev);
+	stmmac_mdio_unregister(ndev);
 error_mdio_register:
 	stmmac_napi_del(ndev);
 error_hw_init:
@@ -7833,10 +7818,8 @@ void stmmac_dvr_remove(struct device *dev)
 	reset_control_assert(priv->plat->stmmac_ahb_rst);
 
 	stmmac_pcs_clean(ndev);
+	stmmac_mdio_unregister(ndev);
 
-	if (priv->hw->pcs != STMMAC_PCS_TBI &&
-	    priv->hw->pcs != STMMAC_PCS_RTBI)
-		stmmac_mdio_unregister(ndev);
 	destroy_workqueue(priv->wq);
 	mutex_destroy(&priv->lock);
 	bitmap_free(priv->af_xdp_zc_qps);
-- 
2.30.2


-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next 1/5] net: stmmac: Drop TBI/RTBI PCS flags
  2024-05-28 13:20     ` Russell King (Oracle)
@ 2024-05-28 20:38       ` Andrew Halaney
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Halaney @ 2024-05-28 20:38 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Serge Semin, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	netdev, linux-stm32, linux-arm-kernel

On Tue, May 28, 2024 at 02:20:27PM GMT, Russell King (Oracle) wrote:
> On Tue, May 28, 2024 at 03:26:10PM +0300, Serge Semin wrote:
> > On Tue, May 28, 2024 at 12:48:37PM +0100, Russell King wrote:
> > > From: Serge Semin <fancer.lancer@gmail.com>
> > > 
> > > First of all the flags are never set by any of the driver parts. If nobody
> > > have them set then the respective statements will always have the same
> > > result. Thus the statements can be simplified or even dropped with no risk
> > > to break things.
> > > 
> > > Secondly shall any of the TBI or RTBI flag is set the MDIO-bus
> > > registration will be bypassed. Why? It really seems weird. It's perfectly
> > > fine to have a TBI/RTBI-capable PHY configured over the MDIO bus
> > > interface.
> > > 
> > > Based on the notes above the TBI/RTBI PCS flags can be freely dropped thus
> > > simplifying the driver code.
> > 
> > Likely by mistake the vast majority of the original patch content has
> > been missing here:
> > https://lore.kernel.org/netdev/20240524210304.9164-3-fancer.lancer@gmail.com/
> 
> I really can't explain this, other than git doing something weird. There
> is no reason that just one hunk that conflicted from a patch would've
> appeared. Should've been as per the below, which it will be when I post
> v2. Thanks for spotting!
> 
> 8<===
> From: Serge Semin <fancer.lancer@gmail.com>
> Subject: [PATCH net-next] net: stmmac: Drop TBI/RTBI PCS flags
> 
> First of all the flags are never set by any of the driver parts. If nobody
> have them set then the respective statements will always have the same
> result. Thus the statements can be simplified or even dropped with no risk
> to break things.
> 
> Secondly shall any of the TBI or RTBI flag is set the MDIO-bus
> registration will be bypassed. Why? It really seems weird. It's perfectly
> fine to have a TBI/RTBI-capable PHY configured over the MDIO bus
> interface.
> 
> Based on the notes above the TBI/RTBI PCS flags can be freely dropped thus
> simplifying the driver code.
> 
> Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next 2/5] net: stmmac: dwxgmac2: remove useless NULL pointer initialisations
  2024-05-28 11:48 ` [PATCH net-next 2/5] net: stmmac: dwxgmac2: remove useless NULL pointer initialisations Russell King (Oracle)
@ 2024-05-28 20:39   ` Andrew Halaney
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Halaney @ 2024-05-28 20:39 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Serge Semin, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	netdev, linux-stm32, linux-arm-kernel

On Tue, May 28, 2024 at 12:48:42PM GMT, Russell King (Oracle) wrote:
> Remove useless NULL pointer initialisations for "PCS" methods from the
> dwxgmac2 code.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next 3/5] net: stmmac: remove pcs_rane() method
  2024-05-28 11:48 ` [PATCH net-next 3/5] net: stmmac: remove pcs_rane() method Russell King (Oracle)
@ 2024-05-28 20:40   ` Andrew Halaney
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Halaney @ 2024-05-28 20:40 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Serge Semin, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	netdev, linux-stm32, linux-arm-kernel

On Tue, May 28, 2024 at 12:48:48PM GMT, Russell King (Oracle) wrote:
> The pcs_rane() method is not called, so lets just remove this
> redundant code.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next 4/5] net: stmmac: remove unnecessary netif_carrier_off()
  2024-05-28 11:48 ` [PATCH net-next 4/5] net: stmmac: remove unnecessary netif_carrier_off() Russell King (Oracle)
@ 2024-05-28 20:41   ` Andrew Halaney
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Halaney @ 2024-05-28 20:41 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Serge Semin, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	netdev, linux-stm32, linux-arm-kernel

On Tue, May 28, 2024 at 12:48:53PM GMT, Russell King (Oracle) wrote:
> It is incorrect to call netif_carrier_off(), or in fact any driver
> teardown, before unregister_netdev() has been called.
> 
> unregister_netdev() unpublishes the network device from userspace, and
> takes the interface down if it was up prior to returning. Therefore,
> once the call has returned, we are guaranteed that .ndo_stop() will
> have been called for an interface that was up. Phylink will take the
> carrier down via phylink_stop(), making any manipulation of the carrier
> in the remove path unnecessary.
> 
> In the stmmac_release() path, the netif_carrier_off() call follows the
> call to phylink_stop(), so this call is redundant.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next 5/5] net: stmmac: include linux/io.h rather than asm/io.h
  2024-05-28 11:48 ` [PATCH net-next 5/5] net: stmmac: include linux/io.h rather than asm/io.h Russell King (Oracle)
@ 2024-05-28 20:48   ` Andrew Halaney
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Halaney @ 2024-05-28 20:48 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Serge Semin, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	netdev, linux-stm32, linux-arm-kernel

On Tue, May 28, 2024 at 12:48:58PM GMT, Russell King (Oracle) wrote:
> Include linux/io.h instead of asm/io.h since linux/ includes are
> preferred.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>

> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
> index d0c7c2320d8d..d413d76a8936 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c

Any reason you didn't wanna treat the other examples of this similarly?

    ahalaney@x1gen2nano ~/git/linux-next (git)-[tags/next-20240528] % git grep "asm/io.h" drivers/net/ethernet/stmicro/stmmac/
    drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c:#include <asm/io.h>
    drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c:#include <asm/io.h>
    drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c:#include <asm/io.h>
    drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c:#include <asm/io.h>
    drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:#include <asm/io.h>
    ahalaney@x1gen2nano ~/git/linux-next (git)-[tags/next-20240528] % 

Thanks for the series,
Andrew

> @@ -15,7 +15,7 @@
>  #include <linux/crc32.h>
>  #include <linux/slab.h>
>  #include <linux/ethtool.h>
> -#include <asm/io.h>
> +#include <linux/io.h>
>  #include "stmmac.h"
>  #include "stmmac_pcs.h"
>  #include "dwmac1000.h"
> -- 
> 2.30.2
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2024-05-28 20:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-28 11:48 [PATCH net-next 0/5] net: stmmac: cleanups Russell King (Oracle)
2024-05-28 11:48 ` [PATCH net-next 1/5] net: stmmac: Drop TBI/RTBI PCS flags Russell King
2024-05-28 12:26   ` Serge Semin
2024-05-28 13:20     ` Russell King (Oracle)
2024-05-28 20:38       ` Andrew Halaney
2024-05-28 11:48 ` [PATCH net-next 2/5] net: stmmac: dwxgmac2: remove useless NULL pointer initialisations Russell King (Oracle)
2024-05-28 20:39   ` Andrew Halaney
2024-05-28 11:48 ` [PATCH net-next 3/5] net: stmmac: remove pcs_rane() method Russell King (Oracle)
2024-05-28 20:40   ` Andrew Halaney
2024-05-28 11:48 ` [PATCH net-next 4/5] net: stmmac: remove unnecessary netif_carrier_off() Russell King (Oracle)
2024-05-28 20:41   ` Andrew Halaney
2024-05-28 11:48 ` [PATCH net-next 5/5] net: stmmac: include linux/io.h rather than asm/io.h Russell King (Oracle)
2024-05-28 20:48   ` Andrew Halaney

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