diff options
author | Marek BehĂșn <marek.behun@nic.cz> | 2019-08-26 23:31:52 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-08-28 06:42:16 +0200 |
commit | 17deaf5cb37a365fd65aaa0e14d1a2e1a50418c7 (patch) | |
tree | 50b88f4d2341f887b7f0bb19f1a5f6d4b04f4114 /drivers/net/dsa/mv88e6xxx/port.c | |
parent | net: dsa: mv88e6xxx: update code operating on hidden registers (diff) | |
download | linux-17deaf5cb37a365fd65aaa0e14d1a2e1a50418c7.tar.xz linux-17deaf5cb37a365fd65aaa0e14d1a2e1a50418c7.zip |
net: dsa: mv88e6xxx: create serdes_get_lane chip operation
Create a serdes_get_lane() method in the mv88e6xxx operations structure.
Use it instead of calling the different implementations.
Also change the methods so that their return value is used only for
error. The lane number is put into a place referred to by a pointer
given as argument. If the port does not have a lane, return -ENODEV.
Lanes are phy addresses, so use u8 as their type.
Signed-off-by: Marek BehĂșn <marek.behun@nic.cz>
Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
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 | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c index c95cdb73e5a2..4b0c58c30fea 100644 --- a/drivers/net/dsa/mv88e6xxx/port.c +++ b/drivers/net/dsa/mv88e6xxx/port.c @@ -395,7 +395,7 @@ phy_interface_t mv88e6390x_port_max_speed_mode(int port) int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, phy_interface_t mode) { - int lane; + u8 lane; u16 cmode; u16 reg; int err; @@ -434,11 +434,11 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, if (cmode == chip->ports[port].cmode) return 0; - lane = mv88e6390x_serdes_get_lane(chip, port); - if (lane < 0 && lane != -ENODEV) - return lane; + err = mv88e6xxx_serdes_get_lane(chip, port, &lane); + if (err && err != -ENODEV) + return err; - if (lane >= 0) { + if (err != -ENODEV) { if (chip->ports[port].serdes_irq) { err = mv88e6390_serdes_irq_disable(chip, port, lane); if (err) @@ -466,9 +466,9 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, chip->ports[port].cmode = cmode; - lane = mv88e6390x_serdes_get_lane(chip, port); - if (lane < 0) - return lane; + err = mv88e6xxx_serdes_get_lane(chip, port, &lane); + if (err) + return err; err = mv88e6390x_serdes_power(chip, port, true); if (err) |