Re: [RFC PATCH net-next 03/10] net: hibmcge: Add mdio and hardware configuration supported in this module

From: Andrew Lunn
Date: Thu Aug 01 2024 - 08:08:22 EST


> > > +/* include phy link and mac link */
> > > +u32 hbg_get_link_status(struct hbg_priv *priv)
> > > +{
> > > + struct phy_device *phydev = priv->mac.phydev;
> > > + int ret;
> > > +
> > > + if (!phydev)
> > > + return HBG_LINK_DOWN;
> > > +
> > > + phy_read_status(phydev);
> > > + if ((phydev->state != PHY_UP && phydev->state != PHY_RUNNING) ||
> > > + !phydev->link)
> > > + return HBG_LINK_DOWN;
> > > +
> > > + ret = hbg_hw_sgmii_autoneg(priv);
> > > + if (ret)
> > > + return HBG_LINK_DOWN;
> > > +
> > > + return HBG_LINK_UP;
> > > +}
> > There should not be any need for this. So why do you have it?
>
> I'll move this to another patch where it's more appropriate.

That does not explain why it is needed. Generally, phylib tells you if
the link is up, as part of the adjust_link callback. Why do you need
to do something which no other driver does?

Andrew