Re: Re: [PATCH net-next v2 1/2] mv88e6xxx: Refactor 6352's serdes functions

From: Fidan Aliyeva

Date: Fri May 01 2026 - 17:03:51 EST


> > @@ -185,7 +200,7 @@ size_t mv88e6352_serdes_get_stats(struct
> > mv88e6xxx_chip *chip, int port,
> >
> > for (i = 0; i < ARRAY_SIZE(mv88e6352_serdes_hw_stats); i++) {
> > stat = &mv88e6352_serdes_hw_stats[i];
> > - value = mv88e6352_serdes_get_stat(chip, stat);
> > + value = mv88e6352_serdes_get_stat(chip,
> > + MV88E6352_ADDR_SERDES, stat);
>
> If you generalise this, you can use the same code for the mv88e6321.
>
> > +void mv88e6352_serdes_get_regs(struct mv88e6xxx_chip *chip, int port,
> > +void *_p) {
> > + int err;
> > +
> > + err = mv88e6352_g2_scratch_port_has_serdes(chip, port);
> > + if (err <= 0)
> > + return;
> > +
> > + mv88e6352_serdes_get_regs_from_lane(chip, MV88E6352_ADDR_SERDES,
> > + _p);
>
> Here as well.

Hi, Andrew. Thank you for your review and feedback on both this and
previous version.

I wanted to make those functions generic and not introduce new functions
other than 6321_serdes_get_lane. However, those functions cannot be
generalised the obvious way because they run with reg_lock already taken
which would cause deadlock in mv88e6352_serdes_get_lane function.

Do you have proposal on how that problem can be avoided to make these
functions generic, too?

Best,
Fidan