From nobody Sat Oct 4 17:31:16 2025 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADE8A30E0C9; Thu, 14 Aug 2025 13:59:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755179947; cv=none; b=BW1d9VA+ZnpR9gg7cw4OY/yVSMzvh8KnKQV9LI53CgxkGYwND5f/yCoYb5E65DX30Lr1uh5DYapd+sSI0R2VxT1TNqzSMEbST2aT9JGDwHMn1Hx0h9pEfEncJ+uOmkIYHQC0yqkxRTpMOb3xuvLwPoeh8XNSSGWUuaKFkHBf4tw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755179947; c=relaxed/simple; bh=y5uIoDc8a0QR0VmuWmo/vaoRN+a7HbWiSp0ZmpkKGS8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TeTNCpJHqI7b/3kXJhI8gmBI1mMbJ91avjJ4Pv/uTMdZLAUorqpegvxgzSoBJSuCKIC+uqz4ZBvp1IrUeNKgCZSnZLm3vDZEE0WtkFl1tShBDu+5YV9thnQQe/Io2ExTOWawJWLFkdwLhA6h1mGTvfFYsbUYRWWoGyJ6bVOo+Vk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=R7SvH4G9; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="R7SvH4G9" Received: by mail.gandi.net (Postfix) with ESMTPSA id 56D074442B; Thu, 14 Aug 2025 13:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1755179943; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GHd6dZLHF20AHVfQQQFgjWrUgqURs/Mu8ZX7rp4Ot54=; b=R7SvH4G9ByhgYnvP8XAdCtgT08YMtZ7PvX8jLLwzJ2rLac3ToNOYYR+GSzSlSUAiwRX0zq 1v7Z/qwJdokwqHXR6vX5H477JPLX+3Qnu0rRSNGSo4dafrL/RhuUlp1M37evQrncbt5msS Lgb0MXxUGxuPXxvCBkT8RXOR+izjzeu5Sql+D4+4OaeO907hy23SOXqBYRN7ncIFiXI6Zd 2bGd984mQVsY9ZC95ulRxQcLt0B0KSd8JL6fQ0koRzaCXh26k0yV2RBfYOv/etHQCqpDHI uWPAZ7yTmbEHgN3VTh/VKOxtl1gL4s6Sny5Oy5kopNViomovRmeIdR1bv10JPQ== From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?UTF-8?q?K=C3=B6ry=20Maincent?= , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Oleksij Rempel , =?UTF-8?q?Nicol=C3=B2=20Veronese?= , Simon Horman , mwojtas@chromium.org, Antoine Tenart , devicetree@vger.kernel.org, Conor Dooley , Krzysztof Kozlowski , Rob Herring , Romain Gantois , Daniel Golle , Dimitri Fedrau 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 Message-ID: <20250814135832.174911-15-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250814135832.174911-1-maxime.chevallier@bootlin.com> References: <20250814135832.174911-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddugeduvdeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhmvgcuvehhvghvrghllhhivghruceomhgrgihimhgvrdgthhgvvhgrlhhlihgvrhessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepveegtdffleffleevueellefgjeefvedvjefhheegfefgffdvfeetgeevudetffdtnecukfhppedvrgdtudemtggsudelmeekugegheemgeeltddtmeeiheeikeemvdelsgdumeelvghfheemvgektgejnecuvehluhhsthgvrhfuihiivgepuddunecurfgrrhgrmhepihhnvghtpedvrgdtudemtggsudelmeekugegheemgeeltddtmeeiheeikeemvdelsgdumeelvghfheemvgektgejpdhhvghlohepfhgvughorhgrrdhhohhmvgdpmhgrihhlfhhrohhmpehmrgigihhmvgdrtghhvghvrghllhhivghrsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopeefuddprhgtphhtthhopegurghvvghmsegurghvvghmlhhofhhtrdhnvghtpdhrtghpthhtohepmhgrgihimhgvrdgthhgvvhgrlhhlihgvrhessghoohhtlhhinhdrtghomhdprhgtphhtthhopehnvghtuggvvhesvhhgvghrr dhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdgrrhhmqdhmshhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepthhhohhmrghsrdhpvghtrgiiiihonhhisegsohhothhlihhnrdgtohhmpdhrtghpthhtoheprghnughrvgifsehluhhnnhdrtghhpdhrtghpthhtohepkhhusggrsehkvghrnhgvlhdrohhrgh X-GND-Sasl: maxime.chevallier@bootlin.com Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Maxime Chevallier --- 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 =3D upstream; struct net_device *dev =3D phydev->attached_dev; @@ -1531,7 +1531,6 @@ int phy_sfp_connect_phy(void *upstream, struct phy_de= vice *phy) =20 return 0; } -EXPORT_SYMBOL(phy_sfp_connect_phy); =20 /** * phy_sfp_disconnect_phy - Disconnect the SFP module's PHY from the upstr= eam 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 =3D upstream; struct net_device *dev =3D phydev->attached_dev; @@ -1551,7 +1550,6 @@ void phy_sfp_disconnect_phy(void *upstream, struct ph= y_device *phy) if (dev) phy_link_topo_del_phy(dev, phy); } -EXPORT_SYMBOL(phy_sfp_disconnect_phy); =20 /** * 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 =3D upstream; =20 @@ -1568,7 +1566,6 @@ void phy_sfp_attach(void *upstream, struct sfp_bus *b= us) phydev->attached_dev->sfp_bus =3D bus; phydev->sfp_bus_attached =3D true; } -EXPORT_SYMBOL(phy_sfp_attach); =20 /** * 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 =3D upstream; =20 @@ -1585,7 +1582,6 @@ void phy_sfp_detach(void *upstream, struct sfp_bus *b= us) phydev->attached_dev->sfp_bus =3D NULL; phydev->sfp_bus_attached =3D false; } -EXPORT_SYMBOL(phy_sfp_detach); =20 static int phy_sfp_module_insert(void *upstream, const struct sfp_eeprom_i= d *id) { @@ -1737,10 +1733,8 @@ static int phy_setup_sfp_port(struct phy_device *phy= dev) /** * 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 =3D 0; @@ -1752,7 +1746,7 @@ int phy_sfp_probe(struct phy_device *phydev, =20 phydev->sfp_bus =3D bus; =20 - ret =3D sfp_bus_add_upstream(bus, phydev, ops); + ret =3D sfp_bus_add_upstream(bus, phydev, &sfp_phydev_ops); sfp_bus_put(bus); } =20 @@ -1761,7 +1755,6 @@ int phy_sfp_probe(struct phy_device *phydev, =20 return ret; } -EXPORT_SYMBOL(phy_sfp_probe); =20 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; =20 - /* Use generic SFP probing only if the driver didn't do so already */ - if (!phydev->sfp_bus) { - ret =3D phy_sfp_probe(phydev, &sfp_phydev_ops); - if (ret) - goto out; - } + ret =3D phy_sfp_probe(phydev); + if (ret) + goto out; =20 if (phydev->n_ports < phydev->max_n_ports) { ret =3D 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); --=20 2.49.0