diff options
author | Vivien Didelot | 2019-10-21 16:51:23 -0400 |
---|---|---|
committer | Jakub Kicinski | 2019-10-22 12:37:07 -0700 |
commit | c0b736282ccf6d9450f3bed55a134f2123a7a565 (patch) | |
tree | 9ea213a9537dd29484ba2edf38b590121957d65e /net/dsa/dsa2.c | |
parent | 0cfec588ec210e82e6572d1fb10db195fcc41a87 (diff) |
net: dsa: use ports list to find first CPU port
Use the new ports list instead of iterating over switches and their
ports when looking up the first CPU port in the tree.
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/dsa2.c')
-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 514c0195e2e8..80191c7702a9 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -186,22 +186,11 @@ static bool dsa_tree_setup_routing_table(struct dsa_switch_tree *dst) static struct dsa_port *dsa_tree_find_first_cpu(struct dsa_switch_tree *dst) { - 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 (dsa_port_is_cpu(dp)) - return dp; - } - } + list_for_each_entry(dp, &dst->ports, list) + if (dsa_port_is_cpu(dp)) + return dp; return NULL; } |