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: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
46df19a8df
commit
a76568865c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user