From patchwork Tue May 7 10:28:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 13656596 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 197B6C25B4F for ; Tue, 7 May 2024 10:28:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=BR4mr3HKwb0ruefJrO5B61PeIbY8PerIfySUXSaCldg=; b=asA8TMLtutYJqm W3eXVtjmYkLuL5OsAeioguR2G3XZg2O0xZ19bGqhuHCuXTgn3cdqEzDsS+/Yg17+MFkdHOS04indh ICDUFcPjeTkRaYdbuUL4cbjqpllCtl6vWBEP8zG2HH29f4WjP1UqnWJiwRHAPjC7mvNznDHov7pyT BDnoYvEs/Fqlt25rgB/gIYK1DGTSgrhtmGhSW+9WMFXgfn9l8XtsuW1LLbjsEYEXbsUOiSk0XKhir r7y/pP8zClleyQc7XltKSZz79gHqQm8rX10lXxEudD54RmHjdDcAjcbd/qOwj7UauLggcVeUvJrdl 4x8lbBpmVS1/fiJWpnqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4I3n-0000000AXCx-0n3z; Tue, 07 May 2024 10:28:35 +0000 Received: from relay4-d.mail.gandi.net ([2001:4b98:dc4:8::224]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4I3k-0000000AX93-0BE0 for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2024 10:28:33 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 0E539E0005; Tue, 7 May 2024 10:28:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715077706; 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; bh=ITqhCXxazLVoon+f4GaKjONLG3gav92beVQ3JgZzLx0=; b=UGjtGGpE4rd7LX+l/EyEO0DnN+BFdH/Xu2VbbKi5pmFj58CLrusoue/Plm15glu3hLdsbp Sw/3iecWrxz2gU0eWaLlQKRMXh7ofmMJ58Ou01Bq/OFucprUxy1aGH67osXz7f6I1Bj5Ed BSptWkqA5GNYma2blriEIzSbjp94VrzYzy51fG2e3TWja+odb+clfRMc55pnZUwHsZVaAX l/nmunTJB9s+SggcgRPr59b5uk1Cam7TnO3vYs9E6lytjIQY4luh2c11a0QGJM6r+vAb4f 1IEUk71xttc8GMlPUSgqBZn6Vr78ltyMOaOkKaFG2eNgM8GhYWnPXa+ekFdQ1Q== From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@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_Maincent?= , Jesse Brandeburg , =?utf-8?q?Marek_Beh=C3=BAn?= , Piergiorgio Beruto , Oleksij Rempel , =?utf-8?q?Nicol=C3=B2_Veronese?= , Simon Horman , mwojtas@chromium.org, Nathan Chancellor , Antoine Tenart Subject: [PATCH net-next 0/2] Fix phy_link_topology initialization Date: Tue, 7 May 2024 12:28:19 +0200 Message-ID: <20240507102822.2023826-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-GND-Sasl: maxime.chevallier@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240507_032832_315545_4A2E8D2A X-CRM114-Status: UNSURE ( 8.78 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Nathan and Heiner reported issues that occur when phylib and phy drivers built as modules expect the phy_link_topology to be initialized, due to wrong use of IS_REACHABLE. This small fixup series addresses that by moving the initialization code into net/core/dev.c, but at the same time implementing lazy initialization to only allocate the topology upon the first PHY insertion. This needed some refactoring, namely pass the netdevice itself as a parameter for phy_link_topology helpers. Thanks Heiner for the help on untangling this, and Nathan for the report. Maxime Chevallier (2): net: phy: phy_link_topology: Pass netdevice to phy_link_topo helpers net: phy: phy_link_topology: Lazy-initialize the link topology drivers/net/phy/phy_device.c | 25 +++++---------- drivers/net/phy/phy_link_topology.c | 44 +++++++++++--------------- include/linux/netdevice.h | 2 ++ include/linux/phy_link_topology.h | 40 +++++++++++++---------- include/linux/phy_link_topology_core.h | 23 +++----------- net/core/dev.c | 38 ++++++++++++++++++---- net/ethtool/netlink.c | 2 +- 7 files changed, 88 insertions(+), 86 deletions(-)