diff options
author | Vivien Didelot <vivien.didelot@gmail.com> | 2019-08-31 23:18:30 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-09-01 22:16:37 +0300 |
commit | 5122d4ec9e8053a5944bf77db6bd6c89143531d7 (patch) | |
tree | e9e122b9db18a1a5d1ad133b8806dcd61b4a39cf /drivers/net/dsa/mv88e6xxx/serdes.h | |
parent | 4241ef52372ebee93f4ed67e08c9316ccb20bdd7 (diff) | |
download | linux-5122d4ec9e8053a5944bf77db6bd6c89143531d7.tar.xz |
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/serdes.h')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/serdes.h | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/serdes.h b/drivers/net/dsa/mv88e6xxx/serdes.h index cb8d287c9388..4718dcca6b3c 100644 --- a/drivers/net/dsa/mv88e6xxx/serdes.h +++ b/drivers/net/dsa/mv88e6xxx/serdes.h @@ -74,22 +74,9 @@ #define MV88E6390_SGMII_PHY_STATUS_SPD_DPL_VALID BIT(11) #define MV88E6390_SGMII_PHY_STATUS_LINK BIT(10) -/* Put the SERDES lane address a port is using into *lane. If a port has - * multiple lanes, should put the first lane the port is using. If a port does - * not have a lane, return -ENODEV. - */ -static inline int mv88e6xxx_serdes_get_lane(struct mv88e6xxx_chip *chip, - int port, u8 *lane) -{ - if (!chip->info->ops->serdes_get_lane) - return -EOPNOTSUPP; - - return chip->info->ops->serdes_get_lane(chip, port, lane); -} - -int mv88e6341_serdes_get_lane(struct mv88e6xxx_chip *chip, int port, u8 *lane); -int mv88e6390_serdes_get_lane(struct mv88e6xxx_chip *chip, int port, u8 *lane); -int mv88e6390x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port, u8 *lane); +u8 mv88e6341_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); +u8 mv88e6390_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); +u8 mv88e6390x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); unsigned int mv88e6352_serdes_irq_mapping(struct mv88e6xxx_chip *chip, int port); unsigned int mv88e6390_serdes_irq_mapping(struct mv88e6xxx_chip *chip, @@ -110,6 +97,16 @@ int mv88e6390_serdes_irq_disable(struct mv88e6xxx_chip *chip, int port, int mv88e6352_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port); void mv88e6352_serdes_irq_free(struct mv88e6xxx_chip *chip, int port); +/* Return the (first) SERDES lane address a port is using, 0 otherwise. */ +static inline u8 mv88e6xxx_serdes_get_lane(struct mv88e6xxx_chip *chip, + int port) +{ + if (!chip->info->ops->serdes_get_lane) + return 0; + + return chip->info->ops->serdes_get_lane(chip, port); +} + static inline unsigned int mv88e6xxx_serdes_irq_mapping(struct mv88e6xxx_chip *chip, int port) { |