net: dsa: mv88e6xxx: add switch register helpers
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Mon, 20 Jun 2016 17:14:02 +0000 (13:14 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jun 2016 07:58:29 +0000 (03:58 -0400)
commitb7e66a5fad73cb0f118471e6ca8aeed3447915dc
tree37c7632161e3ad9f703785f7985576b8004c1a3f
parent1d35f0b2c3fcc8a0c1fd93aba02520c940c0b855
net: dsa: mv88e6xxx: add switch register helpers

The mixed assignments, allocations and registrations in the probe code
make it hard to follow the logic and figure out what is DSA or chip
specific.

Extract the struct dsa_switch related code in a simple
mv88e6xxx_register_switch helper function.

For symmetry in the code, add a mv88e6xxx_unregister_switch function.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx.c