]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: stmmac: explain the phylink_speed_down() call in stmmac_release()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Fri, 15 Aug 2025 11:32:21 +0000 (12:32 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 19 Aug 2025 01:10:12 +0000 (18:10 -0700)
The call to phylink_speed_down() looks odd on the face of it. Add a
comment to explain why this call is there. phylink_speed_up() is
always called in __stmmac_open(), and already has a comment.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/E1umsfV-008vKv-1O@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index b9e8df90e7b5d929702be6a05a85628cbf06689e..0bbdc1f1a6919040194c53c8ddbf4175c48da154 100644 (file)
@@ -4138,8 +4138,13 @@ static int stmmac_release(struct net_device *dev)
        struct stmmac_priv *priv = netdev_priv(dev);
        u32 chan;
 
+       /* If the PHY or MAC has WoL enabled, then the PHY will not be
+        * suspended when phylink_stop() is called below. Set the PHY
+        * to its slowest speed to save power.
+        */
        if (device_may_wakeup(priv->device))
                phylink_speed_down(priv->phylink, false);
+
        /* Stop and disconnect the PHY */
        phylink_stop(priv->phylink);
        phylink_disconnect_phy(priv->phylink);