Patchwork [1/2] net: ethernet: cpsw: Search childs for slave nodes

login
register
mail settings
Submitter Markus Pargmann
Date Oct. 4, 2013, 12:44 p.m.
Message ID <1380890680-30941-1-git-send-email-mpa@pengutronix.de>
Download mbox | patch
Permalink /patch/280584/
State Accepted
Delegated to: David Miller
Headers show

Comments

Markus Pargmann - Oct. 4, 2013, 12:44 p.m.
The current implementation searches the whole DT for nodes named
"slave".

This patch changes it to search only child nodes for slaves.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 drivers/net/ethernet/ti/cpsw.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Mugunthan V N - Oct. 4, 2013, 1:27 p.m.
On Friday 04 October 2013 07:44 AM, Markus Pargmann wrote:
> The current implementation searches the whole DT for nodes named
> "slave".
>
> This patch changes it to search only child nodes for slaves.
>
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Peter Korsgaard - Oct. 4, 2013, 3:24 p.m.
>>>>> "Markus" == Markus Pargmann <mpa@pengutronix.de> writes:

 Markus> The current implementation searches the whole DT for nodes named
 Markus> "slave".

 Markus> This patch changes it to search only child nodes for slaves.

 Markus> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>

Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
David Miller - Oct. 7, 2013, 7:19 p.m.
From: Markus Pargmann <mpa@pengutronix.de>
Date: Fri,  4 Oct 2013 14:44:39 +0200

> The current implementation searches the whole DT for nodes named
> "slave".
> 
> This patch changes it to search only child nodes for slaves.
> 
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 79974e3..5df50a9 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1782,7 +1782,7 @@  static int cpsw_probe_dt(struct cpsw_platform_data *data,
 	if (ret)
 		pr_warn("Doesn't have any child node\n");
 
-	for_each_node_by_name(slave_node, "slave") {
+	for_each_child_of_node(node, slave_node) {
 		struct cpsw_slave_data *slave_data = data->slave_data + i;
 		const void *mac_addr = NULL;
 		u32 phyid;
@@ -1791,6 +1791,10 @@  static int cpsw_probe_dt(struct cpsw_platform_data *data,
 		struct device_node *mdio_node;
 		struct platform_device *mdio;
 
+		/* This is no slave child node, continue */
+		if (strcmp(slave_node->name, "slave"))
+			continue;
+
 		parp = of_get_property(slave_node, "phy_id", &lenp);
 		if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {
 			pr_err("Missing slave[%d] phy_id property\n", i);