[PATCH v2 5/7] dt/net/fsl_pq_mdio: Use of_get_child_by_name to get a named child.

Srinivas KANDAGATLA srinivas.kandagatla at st.com
Fri Sep 14 18:19:42 EST 2012


From: Srinivas Kandagatla <srinivas.kandagatla at st.com>

As follow-up to "dt: introduce of_get_child_by_name to get child node by
name." patch, This patch removes some of the code duplication in the
driver by replacing it with of_get_child_by_name instead.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla at st.com>
---
 drivers/net/ethernet/freescale/fsl_pq_mdio.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
index 9527b28..e710c60 100644
--- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c
+++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
@@ -355,10 +355,7 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev)
 		goto err_free_irqs;
 	}
 
-	for_each_child_of_node(np, tbi) {
-		if (!strncmp(tbi->type, "tbi-phy", 8))
-			break;
-	}
+	tbi = of_get_child_by_name(np, "tbi-phy");
 
 	if (tbi) {
 		const u32 *prop = of_get_property(tbi, "reg", NULL);
-- 
1.7.0.4



More information about the devicetree-discuss mailing list