]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: phy: move phy_link_change() prior to mdio_bus_phy_may_suspend()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 16 Jan 2026 06:53:32 +0000 (14:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 30 Jan 2026 09:27:43 +0000 (10:27 +0100)
[ Upstream commit f40a673d6b4a128fe95dd9b8c3ed02da50a6a862 ]

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 <vladimir.oltean@nxp.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/20250407093900.2155112-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Minor context change fixed ]
Signed-off-by: Rajani Kantha <681739313@139.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/phy/phy_device.c

index 875788918bcb3d8915fb38cfa0a3a7928bf22c88..2c4af6f9639040a3aed48055b7accfaf2ad1d06f 100644 (file)
@@ -268,6 +268,19 @@ static struct phy_driver genphy_driver;
 static LIST_HEAD(phy_fixup_list);
 static DEFINE_MUTEX(phy_fixup_lock);
 
+static void phy_link_change(struct phy_device *phydev, bool up)
+{
+       struct net_device *netdev = phydev->attached_dev;
+
+       if (up)
+               netif_carrier_on(netdev);
+       else
+               netif_carrier_off(netdev);
+       phydev->adjust_link(netdev);
+       if (phydev->mii_ts && phydev->mii_ts->link_state)
+               phydev->mii_ts->link_state(phydev->mii_ts, phydev);
+}
+
 static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
 {
        struct device_driver *drv = phydev->mdio.dev.driver;
@@ -1069,19 +1082,6 @@ struct phy_device *phy_find_first(struct mii_bus *bus)
 }
 EXPORT_SYMBOL(phy_find_first);
 
-static void phy_link_change(struct phy_device *phydev, bool up)
-{
-       struct net_device *netdev = phydev->attached_dev;
-
-       if (up)
-               netif_carrier_on(netdev);
-       else
-               netif_carrier_off(netdev);
-       phydev->adjust_link(netdev);
-       if (phydev->mii_ts && phydev->mii_ts->link_state)
-               phydev->mii_ts->link_state(phydev->mii_ts, phydev);
-}
-
 /**
  * phy_prepare_link - prepares the PHY layer to monitor link status
  * @phydev: target phy_device struct