Re: [PATCH net-next] net: dsa: motorcomm: Resync SMI slave after interrupted MDIO access

From: Andrew Lunn

Date: Sat Nov 14 2026 - 16:28:36 EST


> > > @@ -136,6 +230,9 @@ static int yt921x_reg_mdio_read(void *context, u32 reg, u32 *valp)
> > >
> > > end:
> > > mutex_unlock(&bus->mdio_lock);
> > > +
> > > + if (res)
> > > + mdio->synced = false;
> >
> > Why defer the recovery to the next transaction? Why not do it now. And
> > if the recovery fails, you can report the transaction which actually
> > killed it, which might be useful for debugging.
> >
> > Andrew
>
> If the recovery fails, you have to, anyway, try to resync in the next
> transaction, so recovery here does not help other than adding more
> code.

I don't know why it adds more code. You don't need mdio->synced. You
just call the recovery function. If it fails, it fails, and you assume
the switch is dead, but report the error and keep going. The next
transaction is also likely to fail, probably causing another sync
attempt, which might work, but by then, you have to assume the switch
is wrongly configured, even if the transaction works.

Andrew