Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp423170lqh; Tue, 7 May 2024 03:29:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpWOrEKSUglGK5O6DRmcSuMXtSMerztt45knXmJH/P4NTC41dk05Zu3oAa82xe0HHMh7M9j5QdaheJHxm1hhuGyyb2yVX5a5AR9GT1mQ== X-Google-Smtp-Source: AGHT+IEOv6//sxYHhxAEuHFCzA1ttMoVTI2bTBpSPKzaKx1Rt3kGZBBAb789mCSC4oE95AkK8yQ5 X-Received: by 2002:a05:6808:288c:b0:3c9:7a59:3bbc with SMTP id eu12-20020a056808288c00b003c97a593bbcmr1830167oib.54.1715077777711; Tue, 07 May 2024 03:29:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715077777; cv=pass; d=google.com; s=arc-20160816; b=HogsJ5dvB8pnqGTHip26rkMi8+c3Ea06q8RJ4l5Jp7POtuAUbX/Jfqk29dYr/CgWSK vD27WIcac6Z9YALUN98t5ntxWotZKTXGzEW8SNeKhY91Vq/WK3fmTQJeOf2rEP5TFtvO Zg2BDnXxRGEb5UgfZLkBceCtG0TQYfObKG6iYTXjI1N7tPU9956AVPnUIeH7IWQyRlv2 5Lp9UdTjyqZGKApTAV80uqHZNwOc8PM/qy+NQr/S0XOWmlnJG85LlH/r4iBxoXcm+L2Q F6J7gcE5X/iKSNBHWTvTF0wpHIif2WbsvTWDV1Q6ryHASRpcM5x07FB1+T9mRGjd6+gZ er9Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=ITqhCXxazLVoon+f4GaKjONLG3gav92beVQ3JgZzLx0=; fh=Dinp91LF2KcnzfyOXGg1vCezYXJAYX+8GKPCxLQjq1Q=; b=pK6nqgvFPcmarqOkFGm48Nat+yVue7ru0/ovHQBgrbpne5zkmwHe6e1hh2Hm43uEf+ Xk72aCCAeWx445TmGpENgUd01PURFGGDKanqY0EB4/aEA9CvNzTAoSoPc/lAWUVw9l4J Cb72a7biflzrdNPLscsmIjgRj6gIObY65ujL5Pb0d7JP1wZwqjVPspyZH73TReEgZ79R sO484Y8oc+YsaioE8q73Tc562ROPV/XNUGLc0hyLJC/Ur7gvHNPld55LEGphCbJdx7/B VxG7xVjoCuHtbrVJ/bMLmVrAep4TZMsP245W5bHNLAxrCqd9m4xQcPdCgbZHOUskZQpA 1btA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=UGjtGGpE; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-171101-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171101-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v21-20020a05620a441500b0078ecb975c13si12287666qkp.253.2024.05.07.03.29.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 03:29:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171101-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=UGjtGGpE; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-171101-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171101-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6C4341C23230 for ; Tue, 7 May 2024 10:29:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A719A14F9DF; Tue, 7 May 2024 10:28:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="UGjtGGpE" Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 13BF314EC57; Tue, 7 May 2024 10:28:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715077710; cv=none; b=kf8NYCo9b7coH/0syi8mas0KoVK4DqibG1xv2rpgzhOSc/Op++NG2fvpAsDbjS5YV0WEVNE+T6fv4Y38TpUHMuWXBFjOrtwmI0pwXLVN4gEev6LCXV2S+3daWN/S05aHttgXQKRJANirOe0qF9NlMzncxABqH8PWLI0VmZ5W4yo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715077710; c=relaxed/simple; bh=6CnyBCfUboxU3/U3ye8c0caHs5VAVKFQUQ8qAVJv1h4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MzdefhRpF7pEvMwZWFFfBZ123+iopMNVFYp/CQLR2NhZFOJY6eBSaUtvvgdMsjHCFxw0KTQSo0mkBsZZncMZM0pcr3Y300984V9A80+XjQSnwbeBgGfyLC9HS05mBRd8xbzJ+8BHGaR5nhpecojd0oXBxB8+BJShQrwOjM1sA2g= 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=UGjtGGpE; arc=none smtp.client-ip=217.70.183.196 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 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=20Maincent?= , Jesse Brandeburg , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Piergiorgio Beruto , Oleksij Rempel , =?UTF-8?q?Nicol=C3=B2=20Veronese?= , 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: maxime.chevallier@bootlin.com 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(-) -- 2.44.0