net: dsa: use a single switch statement for port setup
authorVivien Didelot <vivien.didelot@gmail.com>
Mon, 19 Aug 2019 20:00:48 +0000 (16:00 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Aug 2019 19:33:49 +0000 (12:33 -0700)
commit955222ca5281ee7ded6b899605c055b147a15c73
tree976d4c5e45c6d618865918a19e7ec8851fb89519
parentd2187f8e445403b7aeb08e64c1528761154e9ab3
net: dsa: use a single switch statement for port setup

It is currently difficult to read the different steps involved in the
setup and teardown of ports in the DSA code. Keep it simple with a
single switch statement for each port type: UNUSED, CPU, DSA, or USER.

Also no need to call devlink_port_unregister from within dsa_port_setup
as this step is inconditionally handled by dsa_port_teardown on error.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa2.c