diff mbox series

[net-next,v17,02/14] net: sfp: pass the phy_device when disconnecting an sfp module's PHY

Message ID 20240709063039.2909536-3-maxime.chevallier@bootlin.com (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series Introduce PHY listing and link_topology tracking | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next, async
netdev/ynl success Generated files up to date; no warnings/errors; GEN HAS DIFF 2 files changed, 911 insertions(+);
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 816 this patch: 816
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 823 this patch: 823
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 821 this patch: 821
netdev/checkpatch warning WARNING: function definition argument 'struct phy_device *' should also have an identifier name
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 25 this patch: 25
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-07-11--18-00 (tests: 696)

Commit Message

Maxime Chevallier July 9, 2024, 6:30 a.m. UTC
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>
---
 drivers/net/phy/phylink.c | 3 ++-
 drivers/net/phy/sfp-bus.c | 4 ++--
 include/linux/sfp.h       | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

Comments

Christophe Leroy Aug. 14, 2024, 2:29 p.m. UTC | #1
Le 09/07/2024 à 08:30, Maxime Chevallier a écrit :
> 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>

> ---
>   drivers/net/phy/phylink.c | 3 ++-
>   drivers/net/phy/sfp-bus.c | 4 ++--
>   include/linux/sfp.h       | 2 +-
>   3 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 51c526d227fa..ab4e9fc03017 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -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);
>   }
> diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
> index 2f44fc51848f..56953e66bb7b 100644
> --- a/drivers/net/phy/sfp-bus.c
> +++ b/drivers/net/phy/sfp-bus.c
> @@ -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);
> diff --git a/include/linux/sfp.h b/include/linux/sfp.h
> index b14be59550e3..54abb4d22b2e 100644
> --- a/include/linux/sfp.h
> +++ b/include/linux/sfp.h
> @@ -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)
diff mbox series

Patch

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 51c526d227fa..ab4e9fc03017 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -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);
 }
diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
index 2f44fc51848f..56953e66bb7b 100644
--- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c
@@ -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);
diff --git a/include/linux/sfp.h b/include/linux/sfp.h
index b14be59550e3..54abb4d22b2e 100644
--- a/include/linux/sfp.h
+++ b/include/linux/sfp.h
@@ -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)