devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 1/4] net: axienet: setup mdio unconditionally
@ 2022-03-21 15:25 Andy Chiu
  2022-03-21 15:25 ` [PATCH v4 2/4] net: axienet: factor out phy_node in struct axienet_local Andy Chiu
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Andy Chiu @ 2022-03-21 15:25 UTC (permalink / raw)
  To: radhey.shyam.pandey, robert.hancock, michal.simek
  Cc: davem, kuba, pabeni, robh+dt, linux, andrew, netdev, devicetree,
	Andy Chiu, Greentime Hu

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 <andy.chiu@sifive.com>
Reviewed-by: Greentime Hu <greentime.hu@sifive.com>
---
 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 6fd5157f0a6d..5d41b8de840a 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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-03-22 16:51 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-21 15:25 [PATCH v4 1/4] net: axienet: setup mdio unconditionally Andy Chiu
2022-03-21 15:25 ` [PATCH v4 2/4] net: axienet: factor out phy_node in struct axienet_local Andy Chiu
2022-03-21 18:09   ` Robert Hancock
2022-03-21 15:25 ` [PATCH v4 3/4] dt-bindings: net: xilinx_axienet: add pcs-handle attribute Andy Chiu
2022-03-21 15:42   ` Radhey Shyam Pandey
2022-03-21 18:11     ` Robert Hancock
2022-03-21 23:44     ` Rob Herring
2022-03-21 23:56       ` Robert Hancock
2022-03-22  0:21       ` Andrew Lunn
2022-03-22 16:51         ` Rob Herring
2022-03-21 15:25 ` [PATCH v4 4/4] net: axiemac: use a phandle to reference pcs_phy Andy Chiu
2022-03-21 18:12   ` Robert Hancock
2022-03-21 18:08 ` [PATCH v4 1/4] net: axienet: setup mdio unconditionally Robert Hancock
2022-03-21 18:20 ` Andrew Lunn
2022-03-22  4:34   ` Andy Chiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).