On Tue, 3 Nov 2020 18:50:02 +1000 Pavana Sharma wrote: > Returning 0 is no more an error case with MV88E6393 family > which has serdes lane numbers 0, 9 or 10. > So with this change .serdes_get_lane will return lane number > or error (-ENODEV). > > Signed-off-by: Pavana Sharma <pavana.sha...@digi.com>
> mv88e6xxx_reg_lock(chip); > lane = mv88e6xxx_serdes_get_lane(chip, port); > - if (lane && chip->info->ops->serdes_pcs_get_state) > + if ((lane >= 0) && chip->info->ops->serdes_pcs_get_state) unnecessary parenthesis, checkpatch even warns about this > err = chip->info->ops->serdes_pcs_get_state(chip, port, lane, > state); > else > @@ -522,15 +522,15 @@ static void mv88e6xxx_serdes_pcs_an_restart(struct > dsa_switch *ds, int port) > { > struct mv88e6xxx_chip *chip = ds->priv; > const struct mv88e6xxx_ops *ops; > + int lane; > int err = 0; Please keep the reverse xmas tree order of variables int lane; should be after int err = 0; We're ordering full lines, not just the type and name. > - u8 lane; > > ops = chip->info->ops; > > if (ops->serdes_pcs_an_restart) { > mv88e6xxx_reg_lock(chip); > lane = mv88e6xxx_serdes_get_lane(chip, port); > - if (lane) > + if (lane >= 0) > err = ops->serdes_pcs_an_restart(chip, port, lane); > mv88e6xxx_reg_unlock(chip); > void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void > *_p) > { > - u16 *p = _p; > int lane; > + u16 *p = _p; > u16 reg; > int i; ditto > @@ -129,18 +129,18 @@ void mv88e6352_serdes_get_regs(struct mv88e6xxx_chip > *chip, int port, void *_p); > int mv88e6390_serdes_get_regs_len(struct mv88e6xxx_chip *chip, int port); > void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void > *_p); > > -/* Return the (first) SERDES lane address a port is using, 0 otherwise. */ > +/* Return the (first) SERDES lane address a port is using, ERROR otherwise. > */ The usual notation is -errno, instead of ERROR.