Skip to content

Commit f40a673

Browse files
vladimirolteankuba-moo
authored andcommitted
net: phy: move phy_link_change() prior to mdio_bus_phy_may_suspend()
In an upcoming change, mdio_bus_phy_may_suspend() will need to distinguish a phylib-based PHY client from a phylink PHY client. For that, it will need to compare the phydev->phy_link_change() function pointer with the eponymous phy_link_change() provided by phylib. To avoid forward function declarations, the default PHY link state change method should be moved upwards. There is no functional change associated with this patch, it is only to reduce the noise from a real bug fix. Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Russell King (Oracle) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 29d2614 commit f40a673

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

drivers/net/phy/phy_device.c

+13-13
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,19 @@ static bool phy_drv_wol_enabled(struct phy_device *phydev)
244244
return wol.wolopts != 0;
245245
}
246246

247+
static void phy_link_change(struct phy_device *phydev, bool up)
248+
{
249+
struct net_device *netdev = phydev->attached_dev;
250+
251+
if (up)
252+
netif_carrier_on(netdev);
253+
else
254+
netif_carrier_off(netdev);
255+
phydev->adjust_link(netdev);
256+
if (phydev->mii_ts && phydev->mii_ts->link_state)
257+
phydev->mii_ts->link_state(phydev->mii_ts, phydev);
258+
}
259+
247260
static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
248261
{
249262
struct device_driver *drv = phydev->mdio.dev.driver;
@@ -1055,19 +1068,6 @@ struct phy_device *phy_find_first(struct mii_bus *bus)
10551068
}
10561069
EXPORT_SYMBOL(phy_find_first);
10571070

1058-
static void phy_link_change(struct phy_device *phydev, bool up)
1059-
{
1060-
struct net_device *netdev = phydev->attached_dev;
1061-
1062-
if (up)
1063-
netif_carrier_on(netdev);
1064-
else
1065-
netif_carrier_off(netdev);
1066-
phydev->adjust_link(netdev);
1067-
if (phydev->mii_ts && phydev->mii_ts->link_state)
1068-
phydev->mii_ts->link_state(phydev->mii_ts, phydev);
1069-
}
1070-
10711071
/**
10721072
* phy_prepare_link - prepares the PHY layer to monitor link status
10731073
* @phydev: target phy_device struct

0 commit comments

Comments
 (0)