From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A5DF2606A33B for ; Fri, 4 Dec 2026 11:08:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Ca70l+Pt; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=vMiYb70D DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=9ay772sD9IaexDkxaEL7kut+HSXbut9md5ttDEXyuKE=; b=Ca70l+Pt0+LKTQ sunSDxKwH89y3xaF/58GiUrfbkdzemfOyRyfzsgm8uuQFfId3jwdEbeWd7fZSXD0PUHCZT/GqbX9O y0A+XCc0BejcCXoGPB+NNqqDHDM4h0jryOxeDNVAKGB577FWcfj7BOauqpeevhHHNcIDwp1i10qka S4r7XW3dwVKZazXNv1wzIU5UnToZBlnXOdrRINLCHQDJFqU9VcH50C3N775pAjJLlnX9L8o/ssqCW Ace8HLZA5z9LBAguKTyVYfDieGcFXP/qZ2ZqFxKKN4rqhFbXZGhre3O3DZSXtn9h/lHa3uV4jb7/F NaChiZbN+guvATG2bIgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZR9C-000000004Ys-2zWE; Fri, 04 Dec 2026 11:08:16 +0000 Received: from smtpout-04.galae.net ([185.171.202.116]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZR8d-000000004MO-3DI5 for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2026 11:07:47 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id AB548C026D7; Fri, 4 Dec 2026 11:07:49 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id D4564603C4; Fri, 4 Dec 2026 11:07:37 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1D9DB11EA191D; Fri, 04 Dec 2026 12:07:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796382454; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=9ay772sD9IaexDkxaEL7kut+HSXbut9md5ttDEXyuKE=; b=vMiYb70DGXvFt+6Be5YZP5cEWUjD0OuwA3av7J47wrKTdclzhwlBy/TDM0XDCluaKz52q6 VhTvhEPn2e4yG95vWVMGNzbluNKqWW1avhDB885TD3vdYoRAHzku0dmkHFbV6heAekLXou 1qo+k6za2h6xs0wWMJNRqAFNZefC9DQ2RwGMkOmqRzdYXV2MXsOAIot7BiuvgZjts7UzNf D/F0KYCdMzAsNVbq5nt6lH85yO2a92TzL1eaQpN2K6dqMYqV1XZR+tOcIgNTp7NvF7MLtV 6YYWfTdXa4ZQ0oaSuufJxI3sFerIbwwoPop08QkEdJODbrwat9FxmgIppnlOTw== 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 07/12] net: phylink: Factor out phylink_clear_phydev() Date: Fri, 4 Dec 2026 12:06:16 +0100 Message-ID: <20261204110622.1106492-8-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-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261204_030746_706103_F051482E X-CRM114-Status: GOOD ( 13.19 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 When disconnecting from a PHY, phylink first clears its internal references to it, then calls phy_disconnect(). For PHYs that sit behind a mux, we'll only need the first part, as the mux is the one that attaches and detaches the PHYs from the netdev. Split that out in phylink_clear_phydev(), in preparation for the phy_mux support. No functional change intended. Signed-off-by: Maxime Chevallier --- drivers/net/phy/phylink.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 6f5af388210d..03e255f5ceb1 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -2553,14 +2553,7 @@ int phylink_fwnode_phy_connect(struct phylink *pl, } EXPORT_SYMBOL_GPL(phylink_fwnode_phy_connect); -/** - * phylink_disconnect_phy() - disconnect any PHY attached to the phylink - * instance. - * @pl: a pointer to a &struct phylink returned from phylink_create() - * - * Disconnect any current PHY from the phylink instance described by @pl. - */ -void phylink_disconnect_phy(struct phylink *pl) +static struct phy_device *phylink_clear_phydev(struct phylink *pl) { struct phy_device *phy; @@ -2579,10 +2572,25 @@ void phylink_disconnect_phy(struct phylink *pl) } mutex_unlock(&pl->phydev_mutex); - if (phy) { + if (phy) flush_work(&pl->resolve); + + return phy; +} + +/** + * phylink_disconnect_phy() - disconnect any PHY attached to the phylink + * instance. + * @pl: a pointer to a &struct phylink returned from phylink_create() + * + * Disconnect any current PHY from the phylink instance described by @pl. + */ +void phylink_disconnect_phy(struct phylink *pl) +{ + struct phy_device *phy = phylink_clear_phydev(pl); + + if (phy) phy_disconnect(phy); - } } EXPORT_SYMBOL_GPL(phylink_disconnect_phy); -- 2.56.1