diff options
author | Vivien Didelot <vivien.didelot@gmail.com> | 2019-08-31 16:18:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-09-01 12:16:37 -0700 |
commit | 5122d4ec9e8053a5944bf77db6bd6c89143531d7 (patch) | |
tree | e9e122b9db18a1a5d1ad133b8806dcd61b4a39cf /drivers/net/dsa/mv88e6xxx/port.c | |
parent | 4241ef52372ebee93f4ed67e08c9316ccb20bdd7 (diff) | |
download | linux-stable-5122d4ec9e8053a5944bf77db6bd6c89143531d7.tar.gz linux-stable-5122d4ec9e8053a5944bf77db6bd6c89143531d7.tar.bz2 linux-stable-5122d4ec9e8053a5944bf77db6bd6c89143531d7.zip |
net: dsa: mv88e6xxx: simplify .serdes_get_lane
Because the mapping between a SERDES interface and its lane is static,
we don't need to stick with negative error codes actually and we can
simply return 0 if there is no lane, just like the IRQ mapping.
This way we can keep a simple and intuitive API using unsigned lane
numbers while simplifying the implementations with single return
statements. Last but not least, fix the reverse chrismas tree in
mv88e6390x_serdes_get_lane.
Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6xxx/port.c')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/port.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c index 4f841335ea32..06e2bdf6fa82 100644 --- a/drivers/net/dsa/mv88e6xxx/port.c +++ b/drivers/net/dsa/mv88e6xxx/port.c @@ -431,11 +431,8 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, if (cmode == chip->ports[port].cmode) return 0; - err = mv88e6xxx_serdes_get_lane(chip, port, &lane); - if (err && err != -ENODEV) - return err; - - if (err != -ENODEV) { + lane = mv88e6xxx_serdes_get_lane(chip, port); + if (lane) { if (chip->ports[port].serdes_irq) { err = mv88e6390_serdes_irq_disable(chip, port, lane); if (err) @@ -463,9 +460,9 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, chip->ports[port].cmode = cmode; - err = mv88e6xxx_serdes_get_lane(chip, port, &lane); - if (err) - return err; + lane = mv88e6xxx_serdes_get_lane(chip, port); + if (!lane) + return -ENODEV; err = mv88e6390_serdes_power(chip, port, true); if (err) |