Commit bad869b5 authored by Maxime Chevallier's avatar Maxime Chevallier Committed by Jakub Kicinski
Browse files

net: phy: Only rely on phy_port for PHY-driven SFP



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: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Tested-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20260108080041.553250-14-maxime.chevallier@bootlin.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 154bc3b6
Loading
Loading
Loading
Loading
+9 −19
Original line number Diff line number Diff line
@@ -1532,7 +1532,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;
@@ -1542,7 +1542,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
@@ -1554,7 +1553,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;
@@ -1562,7 +1561,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
@@ -1571,7 +1569,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;

@@ -1579,7 +1577,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
@@ -1588,7 +1585,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;

@@ -1596,7 +1593,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)
{
@@ -1753,10 +1749,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;
@@ -1768,7 +1762,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);
	}

@@ -1777,7 +1771,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)
{
@@ -3586,12 +3579,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);
	ret = phy_sfp_probe(phydev);
	if (ret)
		goto out;
	}

	if (phydev->n_ports < phydev->max_n_ports) {
		ret = phy_default_setup_single_port(phydev);
+0 −6
Original line number Diff line number Diff line
@@ -2151,12 +2151,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_next(struct mii_bus *bus, struct phy_device *pos);