diff options
author | Vivien Didelot <vivien.didelot@gmail.com> | 2019-10-21 16:51:21 -0400 |
---|---|---|
committer | Jakub Kicinski <jakub.kicinski@netronome.com> | 2019-10-22 12:37:07 -0700 |
commit | 764b7e624284c3f41bdd15bd4e077d8ec5b8c686 (patch) | |
tree | a26babaa75c2de8c3bca56d5563249c2bf18bd7b /net/dsa | |
parent | 86bfb2c1f4337d3306d235f615d35ba8bbbe4650 (diff) | |
download | linux-stable-764b7e624284c3f41bdd15bd4e077d8ec5b8c686.tar.gz linux-stable-764b7e624284c3f41bdd15bd4e077d8ec5b8c686.tar.bz2 linux-stable-764b7e624284c3f41bdd15bd4e077d8ec5b8c686.zip |
net: dsa: use ports list to find a port by node
Use the new ports list instead of iterating over switches and their
ports to find a port from a given node.
Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/dsa2.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 623805ba8e1a..a4de7ff8b19b 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -113,22 +113,11 @@ static bool dsa_port_is_user(struct dsa_port *dp) static struct dsa_port *dsa_tree_find_port_by_node(struct dsa_switch_tree *dst, struct device_node *dn) { - struct dsa_switch *ds; struct dsa_port *dp; - int device, port; - - for (device = 0; device < DSA_MAX_SWITCHES; device++) { - ds = dst->ds[device]; - if (!ds) - continue; - for (port = 0; port < ds->num_ports; port++) { - dp = &ds->ports[port]; - - if (dp->dn == dn) - return dp; - } - } + list_for_each_entry(dp, &dst->ports, list) + if (dp->dn == dn) + return dp; return NULL; } |