Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.246.84.56 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382431; b=pUflur2LMARROihV8SKBAkvYMIxv4BZ6sz1z/2Uwxw25sB8fFpqh5yFC4rdrU2jEfzNn wyKy0accSskP+k6gnshriUuAJxsZkuwdJcoacGQkztwTZHlz+rdziOiQdTDDReBmRsbV/ zvl2xCUKN6bjpSjGVVCGcn38mklrI9CvC4T0lc9xJOBWLvc4cf2V3OtlkbIv2VHzT4pAV teCHQ0TqC1X4C/8wfgO/JYVDkK4s8o0aIG67qec4RN2o81SPnZejXUjkbG5aPFAEeD9KZ 0B2ZAzcbmMvglc1ZB1zLLXMJKzd5W4B9UHypTRRvbPRPrxsUp5PhU7A09LxEW35jzqg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382431; h=DMARC-Filter:Received:Received:Received:DKIM-Signature:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=BPvTYyrmsk80415NOt+U3j+sbz/E/wmotBR3eA1iWJ8=; b=14kfSmUzR703CDMR4b3hbqDKNWMK8b1yCPd2UsyO2RlRT64FGjaKUE7TqVdh523CzfU+ BpkA5/WPgfD+HvmsigAqLsj4LgtKLjRoV/wIB1lj8M/Vdyl3h7wSiGb7uF3LcIEA4PisO Ceag+/Qg//LaMM6Gb9GFBsKjvMndBqnDWytU5lfmw/x0pO9xxMeBrsr4ZuXj583agU3Z5 pJ+0mG0C5fmUBsPKfnoYd4H1hfl8Otw5EupeVETkix13qR86mM2+CYC8ruv6T0XH48VFB tr8bzLKNhJbFOlN3yTuRFHUzu8COVxnG86j8Mq2Kx2zWz0y/CgnrPZ38rZae7IoJoiw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b="cD/7fAmD"; arc=none smtp.remote-ip=185.246.84.56 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BE87606A332; Fri, 4 Dec 2026 11:07:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2BE87606A332 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.a=rsa-sha256 header.s=dkim header.b=cD/7fAmD Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id D06141A1947; Fri, 4 Dec 2026 11:07:09 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 9AB52603C4; Fri, 4 Dec 2026 11:07:09 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D01B811EA187F; Fri, 04 Dec 2026 12:07:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796382426; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=BPvTYyrmsk80415NOt+U3j+sbz/E/wmotBR3eA1iWJ8=; b=cD/7fAmDa/dJXlLfQYLLdviPodc8nIQG/VcdGFDqO4LRDMKitQ2FmvXDRlHhqvYf3elar1 NvRX9exzcDgsg2FlaLhKzyXVjKml8Un3XTKtD8Wmhsz3WR0D7znq3zyxH6xUmesbevB5+0 kVObEwyma0did8XA0pH5jo189aNeb/aMR5TxNx568l8sCm0bM4amzSBNEBOdsJGfgEqulD +Ujr2fsnlarSqbyTboVYBIUHT+aklWXPWdC4YM0Y764bEHPz4dL6CJeRUyq8TZWM/MNcf6 v/tWGWYTKxhHc1HF/tz0dfcrdwHpR6sdH9jtGygerdV0eKLKpa30woorvmfSJQ== From: Maxime Chevallier To: davem@davemloft.net, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Willem de Bruijn , Paolo Abeni , Russell King , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Sebastian Hesselbarth , Gregory Clement , Heiner Kallweit Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@bootlin.com, devicetree@vger.kernel.org, Conor Dooley , Krzysztof Kozlowski , Rob Herring , Christophe Leroy , Herve Codina , Florian Fainelli , Vladimir Oltean , =?UTF-8?q?K=C3=B6ry=20Maincent?= , Oleksij Rempel , =?UTF-8?q?Nicol=C3=B2=20Veronese?= , Simon Horman , marcin.s.wojtas@gmail.com, Daniel Golle , Dimitri Fedrau , Frank Wunderlich , Pietro Ameruoso , Aleksei Sviridkin Subject: [PATCH net-next 03/12] net: phy: Don't create the sysfs links for PHYs behind a mux Date: Fri, 4 Dec 2026 12:06:12 +0100 Message-ID: <20261204110622.1106492-4-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204110622.1106492-1-maxime.chevallier@bootlin.com> References: <20261204110622.1106492-1-maxime.chevallier@bootlin.com> X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 The phy_mux framework allows attaching multiple PHYs to the same netdev, one of them being actively used at any given time. Attached phys create sysfs links in the netdev entry, pointing to the PHY. We can't have two of them (otherwise they'd overwrite one another), so let's just not create these. PHYs are still visible through the phy_link_topology API. Signed-off-by: Maxime Chevallier --- drivers/net/phy/phy_device.c | 3 ++- include/linux/phy.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 60440b62e6c7..9630578a6a5c 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2019,7 +2019,8 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, */ phydev->sysfs_links = false; - phy_sysfs_create_links(phydev); + if (!phydev->mux_port) + phy_sysfs_create_links(phydev); if (!phydev->attached_dev) { err = sysfs_create_file(&phydev->mdio.dev.kobj, diff --git a/include/linux/phy.h b/include/linux/phy.h index f1b1ad1dd82f..a6cd2fc642ad 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -328,6 +328,7 @@ static inline long rgmii_clock(int speed) struct device; struct kernel_hwtstamp_config; struct phylink; +struct phy_mux_port; struct phy_port; struct sfp_bus; struct sfp_upstream_ops; @@ -618,6 +619,7 @@ struct phy_oatc14_sqi_capability { * @sfp_cage_port: The phy_port connected to the downstream SFP cage * @mod_port: phy_port representing the SFP module, if it is phy-less * @upstream_port: phy_port this PHY's MII attaches to, if any + * @mux_port: The mux port this PHY sits behind, if any * @attached_dev: The attached enet driver's device instance ptr * @adjust_link: Callback for the enet controller to respond to changes: in the * link state. @@ -814,6 +816,7 @@ struct phy_device { struct phy_port *sfp_cage_port; struct phy_port *mod_port; struct phy_port *upstream_port; + struct phy_mux_port *mux_port; struct phylink *phylink; struct net_device *attached_dev; struct mii_timestamper *mii_ts; -- 2.56.1