]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: mt7530: iterate using dsa_switch_for_each_user_port in bridging ops
authorVladimir Oltean <vladimir.oltean@nxp.com>
Mon, 6 Dec 2021 16:57:49 +0000 (18:57 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 8 Dec 2021 22:31:14 +0000 (14:31 -0800)
commit31b06197a971f6ccb90c71b8dd396a689f7d0559
treeb54887840e55209905ac8c6350f1502ce5134a5b
parent06917ced5346a44f09d913f359045c871fbeff3b
net: dsa: mt7530: iterate using dsa_switch_for_each_user_port in bridging ops

Avoid repeated calls to dsa_to_port() (some hidden behind dsa_is_user_port
and some in plain sight) by keeping two struct dsa_port references: one
to the port passed as argument, and another to the other ports of the
switch that we're iterating over.

dsa_to_port(ds, i) gets replaced by other_dp, i gets replaced by
other_port which is derived from other_dp->index, dsa_is_user_port is
handled by the DSA iterator.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/mt7530.c