Commit a7656886 authored by Biju Das's avatar Biju Das Committed by David S. Miller
Browse files

net: dsa: sja1105: Use of_get_available_child_by_name()



Use the helper of_get_available_child_by_name() to simplify
sja1105_mdiobus_register().

Signed-off-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 46df19a8
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -468,13 +468,10 @@ int sja1105_mdiobus_register(struct dsa_switch *ds)
	if (rc)
		return rc;

	mdio_node = of_get_child_by_name(switch_node, "mdios");
	mdio_node = of_get_available_child_by_name(switch_node, "mdios");
	if (!mdio_node)
		return 0;

	if (!of_device_is_available(mdio_node))
		goto out_put_mdio_node;

	if (regs->mdio_100base_tx != SJA1105_RSV_ADDR) {
		rc = sja1105_mdiobus_base_tx_register(priv, mdio_node);
		if (rc)
@@ -487,7 +484,6 @@ int sja1105_mdiobus_register(struct dsa_switch *ds)
			goto err_free_base_tx_mdiobus;
	}

out_put_mdio_node:
	of_node_put(mdio_node);

	return 0;