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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78DFFC433FE for ; Tue, 29 Mar 2022 02:51:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231268AbiC2CxV (ORCPT ); Mon, 28 Mar 2022 22:53:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230475AbiC2CxS (ORCPT ); Mon, 28 Mar 2022 22:53:18 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4AC01B3707 for ; Mon, 28 Mar 2022 19:51:36 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id s8so14598334pfk.12 for ; Mon, 28 Mar 2022 19:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=18aEhZqxqni23oeSOiNVFxkklmTsPbag40eOHFXJhw4=; b=kKdY1AZb7fKL9iY/FdwTBa37vrBkrrH30evEfYQ01+MS4yIuYBeQs0cLp/L1+edmuu hezLQAReiit3wsioUujFm/yjMc+PUl5toX9YEvhfplEav42cz5QrRsHhZHHlnlA9RS0J utmoHYjgEgMpiFxRuGMdxEtFPCSrZfa9wE25Usifjj6Skp6Qtc0LNOC5M0i/2hBIUkVX ZRJfGx+70V8hm2T6eEodsucp9xPuMROOoIMMRUrAIVzG69+wpdcC2AhiUsLltIYG5hNn h1xLuE3KR7ISDObCtlaYTWGUzpC5QvxKjiJ2fcHg6DgOm76yx4QZVDlBu8UgxlsXkzxs kSXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=18aEhZqxqni23oeSOiNVFxkklmTsPbag40eOHFXJhw4=; b=KRqPsSFpfzy9XUgxwFAW8Z7jbo9o/wrQqLsATukFqm/IKCqvx1/TZr/ZOY/C7QnTeF zxjsV5foD1Ahw0ZLu6siy5OMRhj6Xecj5dibLhXKXDO1Q3BidZeuVG2nuAddKVo95z7s hemD5vDsFCPKdQhY9FUIbVIwocY89HDfEi7F+9IyV+no4W0EHE93vFHE8N0OWoKhaT7I VN+1ZRB9XAjKmoGFXFIW8E8i8j3fazFqvs9CldxUAScqpsVWmZz1B77t5sUDFMUO10Rn 5QgkKpMWtFyKN6IMVowI5z6u3mK46iERY752NUXkNvBedX6AqQrsfIx3UMfjLebXZjQR YCvw== X-Gm-Message-State: AOAM5322QPKnPbPooVT1tkZXrEShtgkz5C4b+k5W4lJD6yS+KbClvlrQ RcPg9dNQGjL5+4nfuHueR+eQsw== X-Google-Smtp-Source: ABdhPJz7aObK2yWpJIgjdfrEy6zk/GWdVoGyZl/AA5FMJxv7fHBbQHiTIZVWOhST53EL0Ja52wlVxg== X-Received: by 2002:a63:6f4c:0:b0:386:4801:a83e with SMTP id k73-20020a636f4c000000b003864801a83emr400506pgc.184.1648522296296; Mon, 28 Mar 2022 19:51:36 -0700 (PDT) Received: from archlinux.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id f14-20020a63380e000000b0038253c4d5casm14136053pga.36.2022.03.28.19.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 19:51:36 -0700 (PDT) From: Andy Chiu To: kuba@kernel.org, radhey.shyam.pandey@xilinx.com, robert.hancock@calian.com, michal.simek@xilinx.com, andrew@lunn.ch Cc: davem@davemloft.net, pabeni@redhat.com, robh+dt@kernel.org, linux@armlinux.org.uk, netdev@vger.kernel.org, devicetree@vger.kernel.org, robh@kernel.org, Andy Chiu , Greentime Hu Subject: [PATCH v7 net 1/4] net: axienet: setup mdio unconditionally Date: Tue, 29 Mar 2022 10:49:18 +0800 Message-Id: <20220329024921.2739338-2-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220329024921.2739338-1-andy.chiu@sifive.com> References: <20220329024921.2739338-1-andy.chiu@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The call to axienet_mdio_setup should not depend on whether "phy-node" pressents on the DT. Besides, since `lp->phy_node` is used if PHY is in SGMII or 100Base-X modes, move it into the if statement. And the next patch will remove `lp->phy_node` from driver's private structure and do an of_node_put on it right away after use since it is not used elsewhere. Signed-off-by: Andy Chiu Reviewed-by: Greentime Hu Reviewed-by: Robert Hancock --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index c7eb05e4a6bf..78a991bbbcf9 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2064,15 +2064,14 @@ static int axienet_probe(struct platform_device *pdev) if (ret) goto cleanup_clk; - lp->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); - if (lp->phy_node) { - ret = axienet_mdio_setup(lp); - if (ret) - dev_warn(&pdev->dev, - "error registering MDIO bus: %d\n", ret); - } + ret = axienet_mdio_setup(lp); + if (ret) + dev_warn(&pdev->dev, + "error registering MDIO bus: %d\n", ret); + if (lp->phy_mode == PHY_INTERFACE_MODE_SGMII || lp->phy_mode == PHY_INTERFACE_MODE_1000BASEX) { + lp->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); if (!lp->phy_node) { dev_err(&pdev->dev, "phy-handle required for 1000BaseX/SGMII\n"); ret = -EINVAL; -- 2.34.1