Patchwork drivers: net: ethernet: cpsw: consider number of slaves in interation

login
register
mail settings
Submitter Daniel Mack
Date Feb. 26, 2013, 2:06 p.m.
Message ID <1361887580-1770-1-git-send-email-zonque@gmail.com>
Download mbox | patch
Permalink /patch/223227/
State Accepted
Delegated to: David Miller
Headers show

Comments

Daniel Mack - Feb. 26, 2013, 2:06 p.m.
Make cpsw_add_default_vlan() look at the actual number of slaves for its
iteration, so boards with less than 2 slaves don't ooops at boot.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Mugunthan V N <mugunthanvnm@ti.com>
Cc: David S. Miller <davem@davemloft.net>
---
 drivers/net/ethernet/ti/cpsw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Mugunthan V N - Feb. 26, 2013, 2:55 p.m.
On 2/26/2013 7:36 PM, Daniel Mack wrote:
> Make cpsw_add_default_vlan() look at the actual number of slaves for its
> iteration, so boards with less than 2 slaves don't ooops at boot.
>
> Signed-off-by: Daniel Mack <zonque@gmail.com>
> Cc: Mugunthan V N <mugunthanvnm@ti.com>
> Cc: David S. Miller <davem@davemloft.net>
Looks ok for me

Acked-by: Mugunthan V N <mugunthanvnm@ti.com>
--
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
David Miller - Feb. 26, 2013, 10:26 p.m.
From: Mugunthan V N <mugunthanvnm@ti.com>
Date: Tue, 26 Feb 2013 20:25:46 +0530

> On 2/26/2013 7:36 PM, Daniel Mack wrote:
>> Make cpsw_add_default_vlan() look at the actual number of slaves for
>> its
>> iteration, so boards with less than 2 slaves don't ooops at boot.
>>
>> Signed-off-by: Daniel Mack <zonque@gmail.com>
>> Cc: Mugunthan V N <mugunthanvnm@ti.com>
>> Cc: David S. Miller <davem@davemloft.net>
> Looks ok for me
> 
> Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Applied, thanks.
--
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 7e93df6..01ffbc4 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -731,7 +731,7 @@  static inline void cpsw_add_default_vlan(struct cpsw_priv *priv)
 
 	writel(vlan, &priv->host_port_regs->port_vlan);
 
-	for (i = 0; i < 2; i++)
+	for (i = 0; i < priv->data.slaves; i++)
 		slave_write(priv->slaves + i, vlan, reg);
 
 	cpsw_ale_add_vlan(priv->ale, vlan, ALE_ALL_PORTS << port,