Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1190148lqo; Sat, 11 May 2024 11:11:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVXlYJU7KOFD/FujGl1nnHv4F99Be1PreP+QATC363LIg3USYeXJXnYPysvF5pKLO1DsTahXxBMo7sWgETXIiaXK6iKFyfcQavSG6lRVA== X-Google-Smtp-Source: AGHT+IFhXlAxOPS+c2ryZkmtErmIuFtP3qZowaR2LCCWHq1kA0M/CKUPBKxq3qlqulITP9OUjDx1 X-Received: by 2002:a05:6358:418b:b0:186:1066:7aa0 with SMTP id e5c5f4694b2df-193bd00844emr623368455d.29.1715451101473; Sat, 11 May 2024 11:11:41 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-63412958d5asi5942623a12.662.2024.05.11.11.11.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 11:11:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176676-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=e2jdkaZb; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-176676-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176676-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 139B7281C2F for ; Sat, 11 May 2024 18:11:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3ABBE1CD32; Sat, 11 May 2024 18:11:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e2jdkaZb" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.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 424EB1CA8A; Sat, 11 May 2024 18:11:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715451090; cv=none; b=tQc3zcdJ/QvddwJrhgF5vJFuASuqT/m5qtRdofq5IwYWlwP4RgZGJSF17U0Ism+/AXtTeyVC3gomMJCFlwsGLp6NP8BCSfWBucQdZLBgZPI1hnVbwQ8+CNT0dVXLs46DmxdsuSfghPwTjz4X4D/HsRFLAVgTpLMjUU+c4Ou8k5Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715451090; c=relaxed/simple; bh=+t8uRZp6FGvXN+V4ScRGLv+eJyrrubY4gibWN6mdiHI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Fmp2vJKyLsxf3420WNjsLvJl0gW1eIeIFZbEy3bS89ah3Jz6uKfGsRbFMoKLEQ8m/5EVfWUu72Cp73KLAXBgm7DbifaLtKoKXmpq1qbvq9JBYx3veVla4t8EXURxaQWcGf0MeEcJhhhGYXq2Shj5AYj7NA779JePC+R20XqB0C4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e2jdkaZb; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CD5DC2BBFC; Sat, 11 May 2024 18:11:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715451089; bh=+t8uRZp6FGvXN+V4ScRGLv+eJyrrubY4gibWN6mdiHI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e2jdkaZbC/mdPAuuX1eCHbhGEu4F1appnZLT1q4rOQrw8hs/5sppQXOV2zRweyBYM JTRs/m6M7JXBsqp66uNQmSheaAZglqcUtJ3KTp+CYxoJdYVdL8mkPlW0T9h3sdNZd/ NMAoMhuFa/s8NWyrGFlr48VOgPI0J7tCsvDWvHG2Z4+mJITYr+8ino8G7uaoGs94dq 4IQKjoJsADnxbivm5h7bvNIelFTpLU0gvAMQXaZVDsCvKI+jM49sYKr3VuamE5KHNX TdHySYjtKa8IrqdiexAKN418X1uM8P+d4U6H6DtqFXH+Skitspy7NC7OV4gLXyj7w0 zsmqfQV10pQgQ== Date: Sat, 11 May 2024 19:11:19 +0100 From: Simon Horman To: Romain Gantois Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Russell King , =?utf-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= , Serge Semin , Thomas Petazzoni , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, "Russell King (Oracle)" , Maxime Chevallier Subject: Re: [PATCH net-next v6 4/7] net: stmmac: introduce pcs_init/pcs_exit stmmac operations Message-ID: <20240511181119.GU2347895@kernel.org> References: <20240510-rzn1-gmac1-v6-0-b63942be334c@bootlin.com> <20240510-rzn1-gmac1-v6-4-b63942be334c@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240510-rzn1-gmac1-v6-4-b63942be334c@bootlin.com> On Fri, May 10, 2024 at 09:38:11AM +0200, Romain Gantois wrote: > From: "Russell King (Oracle)" > > Introduce a mechanism whereby platforms can create their PCS instances > prior to the network device being published to userspace, but after > some of the core stmmac initialisation has been completed. This means > that the data structures that platforms need will be available. > > Signed-off-by: Russell King (Oracle) > Reviewed-by: Maxime Chevallier > Reviewed-by: Serge Semin > Co-developed-by: Romain Gantois > Signed-off-by: Romain Gantois > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 +++++++- > include/linux/stmmac.h | 2 ++ > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c > index 778d79cdb2e6d..f562c563aab55 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c > @@ -505,7 +505,10 @@ int stmmac_pcs_setup(struct net_device *ndev) > priv = netdev_priv(ndev); > mode = priv->plat->phy_interface; > > - if (priv->plat->mdio_bus_data && priv->plat->mdio_bus_data->has_xpcs) { > + if (priv->plat->pcs_init) { > + ret = priv->plat->pcs_init(priv); > + } else if (priv->plat->mdio_bus_data && > + priv->plat->mdio_bus_data->has_xpcs) { > /* Try to probe the XPCS by scanning all addresses */ > for (addr = 0; addr < PHY_MAX_ADDR; addr++) { > xpcs = xpcs_create_mdiodev(priv->mii, addr, mode); I am unsure if this can occur, but if priv->plat->pcs_init returns 0 then xpcs will be used while uninitialised towards the end of this function. Flagged by Smatch. ..