[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240406-v6-8-0-net-next-mv88e6xxx-leds-v4-v4-1-eb97665e7f96@lunn.ch>
Date: Sat, 06 Apr 2024 15:13:28 -0500
From: Andrew Lunn <andrew@...n.ch>
To: Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Russell King <linux@...linux.org.uk>,
Gregory Clement <gregory.clement@...tlin.com>
Cc: netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
Vladimir Oltean <vladimir.oltean@....com>
Subject: [PATCH net-next v4 1/8] net: dsa: consolidate setup and teardown
for shared ports
From: Vladimir Oltean <vladimir.oltean@....com>
CPU and DSA ports have the same port setup and teardown logic, only the
string that gets printed on error differs. Consolidate the code paths.
Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
Signed-off-by: Andrew Lunn <andrew@...n.ch>
---
net/dsa/dsa.c | 24 ++----------------------
1 file changed, 2 insertions(+), 22 deletions(-)
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 09d2f5d4b3dd..64369fa5fd07 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -479,23 +479,6 @@ static int dsa_port_setup(struct dsa_port *dp)
dsa_port_disable(dp);
break;
case DSA_PORT_TYPE_CPU:
- if (dp->dn) {
- err = dsa_shared_port_link_register_of(dp);
- if (err)
- break;
- dsa_port_link_registered = true;
- } else {
- dev_warn(ds->dev,
- "skipping link registration for CPU port %d\n",
- dp->index);
- }
-
- err = dsa_port_enable(dp, NULL);
- if (err)
- break;
- dsa_port_enabled = true;
-
- break;
case DSA_PORT_TYPE_DSA:
if (dp->dn) {
err = dsa_shared_port_link_register_of(dp);
@@ -504,7 +487,8 @@ static int dsa_port_setup(struct dsa_port *dp)
dsa_port_link_registered = true;
} else {
dev_warn(ds->dev,
- "skipping link registration for DSA port %d\n",
+ "skipping link registration for %s port %d\n",
+ dsa_port_is_cpu(dp) ? "CPU" : "DSA",
dp->index);
}
@@ -543,10 +527,6 @@ static void dsa_port_teardown(struct dsa_port *dp)
case DSA_PORT_TYPE_UNUSED:
break;
case DSA_PORT_TYPE_CPU:
- dsa_port_disable(dp);
- if (dp->dn)
- dsa_shared_port_link_unregister_of(dp);
- break;
case DSA_PORT_TYPE_DSA:
dsa_port_disable(dp);
if (dp->dn)
--
2.43.0
Powered by blists - more mailing lists