Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4859214rdb; Tue, 12 Dec 2023 11:11:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IF5HmEohJXOYpyTugPRMvfGF9pK0dFyRyCr/I6qthzTsM4ySnt3zM1k2ZcjxG2lk97bIM0F X-Received: by 2002:a17:902:7806:b0:1d3:20dd:9ec9 with SMTP id p6-20020a170902780600b001d320dd9ec9mr1835026pll.17.1702408298219; Tue, 12 Dec 2023 11:11:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702408298; cv=none; d=google.com; s=arc-20160816; b=S/0mxBGpImLqjqmzBd3+4WE7niO23a0CKyaXNYKW+WpAI0lqJ69RVA/YGOq4yAMnK5 PPrBCfwwBADt3rL0qYSzfA9mtsHszynYrMRHhxmTYhqLaUZXsxhlJecw/2NiPjX+O01V PpOAcnPZX387Lweqi/VsL3KshpUasz4hrHkXEypY/XX4jULmUyLsOxPkygT+1+rEz09n 2Eyo5kpiiwtn9/Yqmt4WAA4PVHSwjEIzdzOC8G9GiIo05ro7DO3YxW1bILbthtd7HSH+ /3KjYgex8Z7dBE5yHWspD9WOEl8DH9KBglB8UPCTmtVtg4Pl6Sf7hRqwpQfHDg1eElCu Pp0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=zu77ILlFi8UZdCwbbdfAli/r3ogJZ+gYD8KfnKz3Xto=; fh=rPdNh8GFVy3eQk+8Ai4sqjLp00OhxaeL7ucMcBj7j4c=; b=LBXCUeQ5OpURddtUg6mg2v8/+E2Wpun/8rp3d4XAPFwWZe+E1s08Oi+1jOC3XuqRUP TatEZWbHFGrOAHctqODR6SV37fszT8ll0mH2tbiYxAeZb8i8XTwqVPVAY4RAK02wD2KE gRvDPN/Ql/49y1Wsw4RVF3kxo2Zwa6WfObfMTEmvzdOJ8V6LRppP7eyd6u+j5IK6ub/S Z2iNLDPdq+deFdLw6sLFAx4siPhQN6O5mgRdB1YtoFoa8L4MGQ+v2/f7PKHaNjxw08N/ 08DC8FJUkv0UGL6fs2HpxFRO3sAHJH0gEEhuyfaYEAurMofXnj+DniE+zpLq2JxdiaQi cqEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=AB8mY2O5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id p19-20020a170902b09300b001d07b6a0aeasi8025522plr.325.2023.12.12.11.11.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 11:11:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=AB8mY2O5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 8F654807C6FF; Tue, 12 Dec 2023 11:11:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376733AbjLLTLW (ORCPT + 99 others); Tue, 12 Dec 2023 14:11:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230370AbjLLTLV (ORCPT ); Tue, 12 Dec 2023 14:11:21 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93C9B9F; Tue, 12 Dec 2023 11:11:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zu77ILlFi8UZdCwbbdfAli/r3ogJZ+gYD8KfnKz3Xto=; b=AB8mY2O5mM4iFFqvSp5DxuKAuA 3UDwlqlPYgVWn6YxS3AaRoWtBp9CQ68IQ0DuFL02tdbw+EX/7Q9AaDDztULKReD7U0zeTHDb2SiAB Xg7P+/CZ2c9W/af8rDdr8aPb8tjeOcQmIxUL942L/03Y9eh5FOY9CVSHSflzZ1KrEGb2POHKc1+dM 2lpJJUYMMtLR9A2lEnef9sftipoOsK6cfi21cm1GJaxExy53Xap7TF+mAgbvnuc9PMVdBb7VQpEK+ ofcLhNWqlIRrRXqDQJXBC4Je4I14PQRM4wA1HEEiN50g5f21yZ40gweyU+u3kXzwIDQoZRw3CcnRu bSHtO2jQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:41348) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rD89y-0007IH-0F; Tue, 12 Dec 2023 19:11:14 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rD89z-0000h5-Ik; Tue, 12 Dec 2023 19:11:15 +0000 Date: Tue, 12 Dec 2023 19:11:15 +0000 From: "Russell King (Oracle)" To: Maxime Chevallier Cc: Luo Jie , agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, andrew@lunn.ch, hkallweit1@gmail.com, robert.marko@sartura.hr, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, quic_srichara@quicinc.com Subject: Re: [PATCH v2 1/5] net: mdio: ipq4019: move eth_ldo_rdy before MDIO bus register Message-ID: References: <20231212115151.20016-1-quic_luoj@quicinc.com> <20231212115151.20016-2-quic_luoj@quicinc.com> <20231212135001.6bf40e4d@device.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231212135001.6bf40e4d@device.home> Sender: Russell King (Oracle) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 12 Dec 2023 11:11:35 -0800 (PST) On Tue, Dec 12, 2023 at 01:50:01PM +0100, Maxime Chevallier wrote: > Hello, > > On Tue, 12 Dec 2023 19:51:46 +0800 > Luo Jie wrote: > > @@ -252,11 +244,32 @@ static int ipq4019_mdio_probe(struct platform_device *pdev) > > if (IS_ERR(priv->mdio_clk)) > > return PTR_ERR(priv->mdio_clk); > > > > - /* The platform resource is provided on the chipset IPQ5018 */ > > - /* This resource is optional */ > > - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > > - if (res) > > - priv->eth_ldo_rdy = devm_ioremap_resource(&pdev->dev, res); > > + /* These platform resources are provided on the chipset IPQ5018 or > > + * IPQ5332. > > + */ > > + /* This resource are optional */ > > + for (index = 0; index < ETH_LDO_RDY_CNT; index++) { > > + res = platform_get_resource(pdev, IORESOURCE_MEM, index + 1); > > + if (res) { > > + priv->eth_ldo_rdy[index] = devm_ioremap(&pdev->dev, > > + res->start, > > + resource_size(res)); > > You can simplify that sequence by using > devm_platform_get_and_ioremap_resource(), which will do both the > platform_get_resource and the devm_ioremap at once for you. Sadly it can't if resources are optional. __devm_ioremap_resource() which will be capped by devm_platform_get_and_ioremap_resource() will be passed a NULL 'res', which will lead to: if (!res || resource_type(res) != IORESOURCE_MEM) { dev_err(dev, "invalid resource %pR\n", res); return IOMEM_ERR_PTR(-EINVAL); } There isn't an "optional" version of devm_platform_get_and_ioremap_resource(). -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!