Re: [PATCH net-next v2 3/5] net: sfp: create/destroy I2C mdiobus before PHY probe/after PHY release

Russell King - ARM Linux admin
2020-10-30T16:32:02Z

On Thu, Oct 29, 2020 at 11:25:07PM +0100, Marek Behún wrote:
> @@ -1936,8 +1950,10 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
> sfp_sm_link_down(sfp);
> if (sfp->sm_state > SFP_S_INIT)
> sfp_module_stop(sfp->sfp_bus);
> - if (sfp->mod_phy)
> + if (sfp->mod_phy) {
> sfp_sm_phy_detach(sfp);
> + sfp_i2c_mdiobus_destroy(sfp);
> + }

if (sfp->mod_phy)
sfp_sm_phy_detach(sfp);
if (sfp->i2c_mii)
sfp_i2c_mdiobus_destroy(sfp);

would be better IMHO, in case we end up with the MDIO bus registered
but don't discover a PHY. (which is entirely possible with Mikrotik
SFPs where the PHY is not accessible.)

Other than that, I don't see any obvious issues.

Thanks.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!