net: sfp: pass the phy_device when disconnecting an sfp module's PHY
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Wed, 21 Aug 2024 15:09:56 +0000 (17:09 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Aug 2024 12:04:34 +0000 (13:04 +0100)
Pass the phy_device as a parameter to the sfp upstream .disconnect_phy
operation. This is preparatory work to help track phy devices across
a net_device's link.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Tested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phylink.c
drivers/net/phy/sfp-bus.c
include/linux/sfp.h

index 51c526d227fab32afc1f5dd261850fd7c51fa17d..ab4e9fc03017d677caabe21a329de6a02b17f7c4 100644 (file)
@@ -3423,7 +3423,8 @@ static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
        return ret;
 }
 
-static void phylink_sfp_disconnect_phy(void *upstream)
+static void phylink_sfp_disconnect_phy(void *upstream,
+                                      struct phy_device *phydev)
 {
        phylink_disconnect_phy(upstream);
 }
index 2f44fc51848f44373e2a3539f75350379a0f0c9d..56953e66bb7b2deba048865ba210fcb41280d469 100644 (file)
@@ -487,7 +487,7 @@ static void sfp_unregister_bus(struct sfp_bus *bus)
                        bus->socket_ops->stop(bus->sfp);
                bus->socket_ops->detach(bus->sfp);
                if (bus->phydev && ops && ops->disconnect_phy)
-                       ops->disconnect_phy(bus->upstream);
+                       ops->disconnect_phy(bus->upstream, bus->phydev);
        }
        bus->registered = false;
 }
@@ -743,7 +743,7 @@ void sfp_remove_phy(struct sfp_bus *bus)
        const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus);
 
        if (ops && ops->disconnect_phy)
-               ops->disconnect_phy(bus->upstream);
+               ops->disconnect_phy(bus->upstream, bus->phydev);
        bus->phydev = NULL;
 }
 EXPORT_SYMBOL_GPL(sfp_remove_phy);
index b14be59550e37c8e7c11552b52aea2cc6f46aafa..54abb4d22b2ec3ab056c5444466e3a7190ddeca0 100644 (file)
@@ -550,7 +550,7 @@ struct sfp_upstream_ops {
        void (*link_down)(void *priv);
        void (*link_up)(void *priv);
        int (*connect_phy)(void *priv, struct phy_device *);
-       void (*disconnect_phy)(void *priv);
+       void (*disconnect_phy)(void *priv, struct phy_device *);
 };
 
 #if IS_ENABLED(CONFIG_SFP)