Skip to contentSkip to conversation

net: dsa: mt7530: correct ds->num_ports

PATCH Applied DENG Qingfang 4 participants 6 messages Oct 16, 2021 – Oct 19, 2021

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: mt7530: correct ds->num_ports

Setting ds->num_ports to DSA_MAX_PORTS made DSA core allocate unnecessary dsa_port's and call mt7530_port_disable for non-existent ports.

Set it to MT7530_NUM_PORTS to fix that, and dsa_is_user_port check in port_enable/disable is no longer required.

---
 drivers/net/dsa/mt7530.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/net/dsa/mt7530.c +1 -7
index a3b49abd32f1..dbd15da977b5 100644
@@ -1035,9 +1035,6 @@ mt7530_port_enable(struct dsa_switch *ds, int port,
 {
 	struct mt7530_priv *priv = ds->priv;
 
-	if (!dsa_is_user_port(ds, port))
-		return 0;
-
 	mutex_lock(&priv->reg_mutex);
 
 	/* Allow the user port gets connected to the cpu port and also
@@ -1060,9 +1057,6 @@ mt7530_port_disable(struct dsa_switch *ds, int port)
 {
 	struct mt7530_priv *priv = ds->priv;
 
-	if (!dsa_is_user_port(ds, port))
-		return;
-
 	mutex_lock(&priv->reg_mutex);
 
 	/* Clear up all port matrix which could be restored in the next
@@ -3265,7 +3259,7 @@ mt7530_probe(struct mdio_device *mdiodev)
 		return -ENOMEM;
 
 	priv->ds->dev = &mdiodev->dev;
-	priv->ds->num_ports = DSA_MAX_PORTS;
+	priv->ds->num_ports = MT7530_NUM_PORTS;
 
 	/* Use medatek,mcm property to distinguish hardware type that would
 	 * casues a little bit differences on power-on sequence.
Signature · 1 line
2.25.1
#1 lore raw
Quoted 8 lines · DENG Qingfang

Setting ds->num_ports to DSA_MAX_PORTS made DSA core allocate unnecessary dsa_port's and call mt7530_port_disable for non-existent ports.

Set it to MT7530_NUM_PORTS to fix that, and dsa_is_user_port check in port_enable/disable is no longer required.

Do you really want to target the net tree for this change?

Signature · 1 line
Florian
#2 lore raw
Quoted 11 lines · Florian Fainelli
Quoted 8 lines · DENG Qingfang

Setting ds->num_ports to DSA_MAX_PORTS made DSA core allocate unnecessary dsa_port's and call mt7530_port_disable for non-existent ports.

Set it to MT7530_NUM_PORTS to fix that, and dsa_is_user_port check in port_enable/disable is no longer required.

Do you really want to target the net tree for this change?

Yes because I consider this a bug fix.

#3 lore raw
Quoted 8 lines · DENG Qingfang
Quoted 7 lines · Florian Fainelli
Quoted 6 lines · DENG Qingfang

Setting ds->num_ports to DSA_MAX_PORTS made DSA core allocate unnecessary dsa_port's and call mt7530_port_disable for non-existent ports.

Set it to MT7530_NUM_PORTS to fix that, and dsa_is_user_port check in port_enable/disable is no longer required.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Do you really want to target the net tree for this change?

Yes because I consider this a bug fix.

OK, why not provide a Fixes tag to help with targeting the back port then? This has been applied anyway, so hopefully the auto selection will do its job and tell you where it stops applying cleanly.

Signature · 1 line
Florian
maintainer
#4 lore raw
Quoted 12 lines · Florian Fainelli
Quoted 11 lines · DENG Qingfang
Quoted 10 lines · Florian Fainelli
Quoted 8 lines · DENG Qingfang

Setting ds->num_ports to DSA_MAX_PORTS made DSA core allocate unnecessary dsa_port's and call mt7530_port_disable for non-existent ports.

Set it to MT7530_NUM_PORTS to fix that, and dsa_is_user_port check in port_enable/disable is no longer required.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Do you really want to target the net tree for this change?

Yes because I consider this a bug fix.

OK, why not provide a Fixes tag to help with targeting the back port then? This has been applied anyway, so hopefully the auto selection will do its job and tell you where it stops applying cleanly.

Without a "Fixes:" tag, I just backport things as far are they are easy to go and then stop without an email saying anything fails on older kernels.

thanks,

greg k-h

#5 lore raw
In reply to DENG Qingfang
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 10 lines · On Sat, 16 Oct 2021 14:24:14 +0800 you wrote:

Setting ds->num_ports to DSA_MAX_PORTS made DSA core allocate unnecessary dsa_port's and call mt7530_port_disable for non-existent ports.

Set it to MT7530_NUM_PORTS to fix that, and dsa_is_user_port check in port_enable/disable is no longer required.

[...]

Here is the summary with links:
- [net] net: dsa: mt7530: correct ds->num_ports

    https://git.kernel.org/netdev/net/c/342afce10d6f

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