Skip to content

Commit 4d76f11

Browse files
minimaxwelldavem330
authored andcommitted
net: sfp: pass the phy_device when disconnecting an sfp module's PHY
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>
1 parent 3849687 commit 4d76f11

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

drivers/net/phy/phylink.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3423,7 +3423,8 @@ static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
34233423
return ret;
34243424
}
34253425

3426-
static void phylink_sfp_disconnect_phy(void *upstream)
3426+
static void phylink_sfp_disconnect_phy(void *upstream,
3427+
struct phy_device *phydev)
34273428
{
34283429
phylink_disconnect_phy(upstream);
34293430
}

drivers/net/phy/sfp-bus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ static void sfp_unregister_bus(struct sfp_bus *bus)
487487
bus->socket_ops->stop(bus->sfp);
488488
bus->socket_ops->detach(bus->sfp);
489489
if (bus->phydev && ops && ops->disconnect_phy)
490-
ops->disconnect_phy(bus->upstream);
490+
ops->disconnect_phy(bus->upstream, bus->phydev);
491491
}
492492
bus->registered = false;
493493
}
@@ -743,7 +743,7 @@ void sfp_remove_phy(struct sfp_bus *bus)
743743
const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus);
744744

745745
if (ops && ops->disconnect_phy)
746-
ops->disconnect_phy(bus->upstream);
746+
ops->disconnect_phy(bus->upstream, bus->phydev);
747747
bus->phydev = NULL;
748748
}
749749
EXPORT_SYMBOL_GPL(sfp_remove_phy);

include/linux/sfp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ struct sfp_upstream_ops {
550550
void (*link_down)(void *priv);
551551
void (*link_up)(void *priv);
552552
int (*connect_phy)(void *priv, struct phy_device *);
553-
void (*disconnect_phy)(void *priv);
553+
void (*disconnect_phy)(void *priv, struct phy_device *);
554554
};
555555

556556
#if IS_ENABLED(CONFIG_SFP)

0 commit comments

Comments
 (0)