mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
Merge branch 'net-phy-some-cleanups-following-phy_port-sfp'
Maxime Chevallier says: ==================== net: phy: some cleanups following phy_port SFP While posting the v11 of phy_port netlink, sashiko found some pre-existing issues, and following the tentative fix, Nicolai found some more :) This is V3, with a re-ordering of the port/sfp cleanup, as well as a new patch (patch 3) that also reorders the phy_remove() path. ==================== Link: https://patch.msgid.link/20260604092819.723505-1-maxime.chevallier@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
83fc67ccbd
|
|
@ -1718,6 +1718,9 @@ static int phy_sfp_probe(struct phy_device *phydev)
|
|||
|
||||
ret = sfp_bus_add_upstream(bus, phydev, &sfp_phydev_ops);
|
||||
sfp_bus_put(bus);
|
||||
|
||||
if (ret)
|
||||
phydev->sfp_bus = NULL;
|
||||
}
|
||||
|
||||
if (!ret && phydev->sfp_bus)
|
||||
|
|
@ -3509,9 +3512,15 @@ static int phy_setup_ports(struct phy_device *phydev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = phy_sfp_probe(phydev);
|
||||
if (ret)
|
||||
goto out;
|
||||
/* We don't support SFP with genphy drivers. Also, genphy driver
|
||||
* binding occurs with RTNL help, which will deadlock the call to
|
||||
* sfp_bus_add_upstream().
|
||||
*/
|
||||
if (!phydev->is_genphy_driven) {
|
||||
ret = phy_sfp_probe(phydev);
|
||||
if (ret)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (phydev->n_ports < phydev->max_n_ports) {
|
||||
ret = phy_default_setup_single_port(phydev);
|
||||
|
|
@ -3775,6 +3784,11 @@ static int phy_probe(struct device *dev)
|
|||
return 0;
|
||||
|
||||
out:
|
||||
sfp_bus_del_upstream(phydev->sfp_bus);
|
||||
phydev->sfp_bus = NULL;
|
||||
|
||||
phy_cleanup_ports(phydev);
|
||||
|
||||
if (!phydev->is_on_sfp_module)
|
||||
phy_led_triggers_unregister(phydev);
|
||||
|
||||
|
|
@ -3798,11 +3812,11 @@ static int phy_remove(struct device *dev)
|
|||
|
||||
phydev->state = PHY_DOWN;
|
||||
|
||||
phy_cleanup_ports(phydev);
|
||||
|
||||
sfp_bus_del_upstream(phydev->sfp_bus);
|
||||
phydev->sfp_bus = NULL;
|
||||
|
||||
phy_cleanup_ports(phydev);
|
||||
|
||||
if (phydev->drv && phydev->drv->remove)
|
||||
phydev->drv->remove(phydev);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user