From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: davem@davemloft.net
Cc: "Maxime Chevallier" <maxime.chevallier@bootlin.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, thomas.petazzoni@bootlin.com,
"Andrew Lunn" <andrew@lunn.ch>,
"Jakub Kicinski" <kuba@kernel.org>,
"Eric Dumazet" <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Russell King" <linux@armlinux.org.uk>,
linux-arm-kernel@lists.infradead.org,
"Christophe Leroy" <christophe.leroy@csgroup.eu>,
"Herve Codina" <herve.codina@bootlin.com>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Vladimir Oltean" <vladimir.oltean@nxp.com>,
"Köry Maincent" <kory.maincent@bootlin.com>,
"Marek Behún" <kabel@kernel.org>,
"Oleksij Rempel" <o.rempel@pengutronix.de>,
"Nicolò Veronese" <nicveronese@gmail.com>,
"Simon Horman" <horms@kernel.org>,
mwojtas@chromium.org, "Antoine Tenart" <atenart@kernel.org>,
devicetree@vger.kernel.org, "Conor Dooley" <conor+dt@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Romain Gantois" <romain.gantois@bootlin.com>,
"Daniel Golle" <daniel@makrotopia.org>,
"Dimitri Fedrau" <dimitri.fedrau@liebherr.com>
Subject: [PATCH net-next v11 14/16] net: phy: Only rely on phy_port for PHY-driven SFP
Date: Thu, 14 Aug 2025 15:58:29 +0200 [thread overview]
Message-ID: <20250814135832.174911-15-maxime.chevallier@bootlin.com> (raw)
In-Reply-To: <20250814135832.174911-1-maxime.chevallier@bootlin.com>
Now that all PHY drivers that support downstream SFP have been converted
to phy_port serdes handling, we can make the generic PHY SFP handling
mandatory, thus making all phylib sfp helpers static.
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
drivers/net/phy/phy_device.c | 28 +++++++++-------------------
include/linux/phy.h | 6 ------
2 files changed, 9 insertions(+), 25 deletions(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 038b38ad5c35..dba9ad40461f 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1521,7 +1521,7 @@ static DEVICE_ATTR_RO(phy_standalone);
*
* Return: 0 on success, otherwise a negative error code.
*/
-int phy_sfp_connect_phy(void *upstream, struct phy_device *phy)
+static int phy_sfp_connect_phy(void *upstream, struct phy_device *phy)
{
struct phy_device *phydev = upstream;
struct net_device *dev = phydev->attached_dev;
@@ -1531,7 +1531,6 @@ int phy_sfp_connect_phy(void *upstream, struct phy_device *phy)
return 0;
}
-EXPORT_SYMBOL(phy_sfp_connect_phy);
/**
* phy_sfp_disconnect_phy - Disconnect the SFP module's PHY from the upstream PHY
@@ -1543,7 +1542,7 @@ EXPORT_SYMBOL(phy_sfp_connect_phy);
* will be destroyed, re-inserting the same module will add a new phy with a
* new index.
*/
-void phy_sfp_disconnect_phy(void *upstream, struct phy_device *phy)
+static void phy_sfp_disconnect_phy(void *upstream, struct phy_device *phy)
{
struct phy_device *phydev = upstream;
struct net_device *dev = phydev->attached_dev;
@@ -1551,7 +1550,6 @@ void phy_sfp_disconnect_phy(void *upstream, struct phy_device *phy)
if (dev)
phy_link_topo_del_phy(dev, phy);
}
-EXPORT_SYMBOL(phy_sfp_disconnect_phy);
/**
* phy_sfp_attach - attach the SFP bus to the PHY upstream network device
@@ -1560,7 +1558,7 @@ EXPORT_SYMBOL(phy_sfp_disconnect_phy);
*
* This is used to fill in the sfp_upstream_ops .attach member.
*/
-void phy_sfp_attach(void *upstream, struct sfp_bus *bus)
+static void phy_sfp_attach(void *upstream, struct sfp_bus *bus)
{
struct phy_device *phydev = upstream;
@@ -1568,7 +1566,6 @@ void phy_sfp_attach(void *upstream, struct sfp_bus *bus)
phydev->attached_dev->sfp_bus = bus;
phydev->sfp_bus_attached = true;
}
-EXPORT_SYMBOL(phy_sfp_attach);
/**
* phy_sfp_detach - detach the SFP bus from the PHY upstream network device
@@ -1577,7 +1574,7 @@ EXPORT_SYMBOL(phy_sfp_attach);
*
* This is used to fill in the sfp_upstream_ops .detach member.
*/
-void phy_sfp_detach(void *upstream, struct sfp_bus *bus)
+static void phy_sfp_detach(void *upstream, struct sfp_bus *bus)
{
struct phy_device *phydev = upstream;
@@ -1585,7 +1582,6 @@ void phy_sfp_detach(void *upstream, struct sfp_bus *bus)
phydev->attached_dev->sfp_bus = NULL;
phydev->sfp_bus_attached = false;
}
-EXPORT_SYMBOL(phy_sfp_detach);
static int phy_sfp_module_insert(void *upstream, const struct sfp_eeprom_id *id)
{
@@ -1737,10 +1733,8 @@ static int phy_setup_sfp_port(struct phy_device *phydev)
/**
* phy_sfp_probe - probe for a SFP cage attached to this PHY device
* @phydev: Pointer to phy_device
- * @ops: SFP's upstream operations
*/
-int phy_sfp_probe(struct phy_device *phydev,
- const struct sfp_upstream_ops *ops)
+static int phy_sfp_probe(struct phy_device *phydev)
{
struct sfp_bus *bus;
int ret = 0;
@@ -1752,7 +1746,7 @@ int phy_sfp_probe(struct phy_device *phydev,
phydev->sfp_bus = bus;
- ret = sfp_bus_add_upstream(bus, phydev, ops);
+ ret = sfp_bus_add_upstream(bus, phydev, &sfp_phydev_ops);
sfp_bus_put(bus);
}
@@ -1761,7 +1755,6 @@ int phy_sfp_probe(struct phy_device *phydev,
return ret;
}
-EXPORT_SYMBOL(phy_sfp_probe);
static bool phy_drv_supports_irq(const struct phy_driver *phydrv)
{
@@ -3561,12 +3554,9 @@ static int phy_setup_ports(struct phy_device *phydev)
if (ret)
return ret;
- /* Use generic SFP probing only if the driver didn't do so already */
- if (!phydev->sfp_bus) {
- ret = phy_sfp_probe(phydev, &sfp_phydev_ops);
- if (ret)
- goto out;
- }
+ ret = phy_sfp_probe(phydev);
+ if (ret)
+ goto out;
if (phydev->n_ports < phydev->max_n_ports) {
ret = phy_default_setup_single_port(phydev);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 5bfd542cbfc8..3276380b2b52 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1854,12 +1854,6 @@ int phy_suspend(struct phy_device *phydev);
int phy_resume(struct phy_device *phydev);
int __phy_resume(struct phy_device *phydev);
int phy_loopback(struct phy_device *phydev, bool enable, int speed);
-int phy_sfp_connect_phy(void *upstream, struct phy_device *phy);
-void phy_sfp_disconnect_phy(void *upstream, struct phy_device *phy);
-void phy_sfp_attach(void *upstream, struct sfp_bus *bus);
-void phy_sfp_detach(void *upstream, struct sfp_bus *bus);
-int phy_sfp_probe(struct phy_device *phydev,
- const struct sfp_upstream_ops *ops);
struct phy_device *phy_attach(struct net_device *dev, const char *bus_id,
phy_interface_t interface);
struct phy_device *phy_find_first(struct mii_bus *bus);
--
2.49.0
next prev parent reply other threads:[~2025-08-14 13:59 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 13:58 [PATCH net-next v11 00/16] net: phy: Introduce PHY ports representation Maxime Chevallier
2025-08-14 13:58 ` [PATCH net-next v11 01/16] dt-bindings: net: Introduce the ethernet-connector description Maxime Chevallier
2025-08-14 13:58 ` [PATCH net-next v11 02/16] net: ethtool: common: Indicate that BaseT works on up to 4 lanes Maxime Chevallier
2025-08-14 13:58 ` [PATCH net-next v11 03/16] net: ethtool: Introduce ETHTOOL_LINK_MEDIUM_* values Maxime Chevallier
2025-08-14 13:58 ` [PATCH net-next v11 04/16] net: phy: Introduce PHY ports representation Maxime Chevallier
2025-08-14 13:58 ` [PATCH net-next v11 05/16] net: phy: dp83822: Add support for phy_port representation Maxime Chevallier
2025-08-14 13:58 ` [PATCH net-next v11 06/16] dt-bindings: net: dp83822: Deprecate ti,fiber-mode Maxime Chevallier
2025-08-14 22:34 ` Rob Herring
2025-08-14 13:58 ` [PATCH net-next v11 07/16] net: phy: Create a phy_port for PHY-driven SFPs Maxime Chevallier
2025-08-14 13:58 ` [PATCH net-next v11 08/16] net: phy: Introduce generic SFP handling for PHY drivers Maxime Chevallier
2025-08-15 3:25 ` kernel test robot
2025-08-22 9:59 ` Maxime Chevallier
2025-08-27 14:10 ` Simon Horman
2025-08-14 13:58 ` [PATCH net-next v11 09/16] net: phy: marvell-88x2222: Support SFP through phy_port interface Maxime Chevallier
2025-08-14 13:58 ` [PATCH net-next v11 10/16] net: phy: marvell: " Maxime Chevallier
2025-08-14 13:58 ` [PATCH net-next v11 11/16] net: phy: marvell10g: Support SFP through phy_port Maxime Chevallier
2025-08-14 13:58 ` [PATCH net-next v11 12/16] net: phy: at803x: Support SFP through phy_port interface Maxime Chevallier
2025-08-14 13:58 ` [PATCH net-next v11 13/16] net: phy: qca807x: " Maxime Chevallier
2025-08-14 13:58 ` Maxime Chevallier [this message]
2025-08-14 13:58 ` [PATCH net-next v11 15/16] net: phy: dp83822: Add SFP support through the " Maxime Chevallier
2025-08-14 13:58 ` [PATCH net-next v11 16/16] Documentation: networking: Document the phy_port infrastructure Maxime Chevallier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250814135832.174911-15-maxime.chevallier@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=andrew@lunn.ch \
--cc=atenart@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=conor+dt@kernel.org \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dimitri.fedrau@liebherr.com \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=herve.codina@bootlin.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=kabel@kernel.org \
--cc=kory.maincent@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mwojtas@chromium.org \
--cc=netdev@vger.kernel.org \
--cc=nicveronese@gmail.com \
--cc=o.rempel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=romain.gantois@bootlin.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).