diff options
-rw-r--r-- | drivers/net/ethernet/ti/cpsw.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 93a60e238146..1c1e7a82f909 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -355,12 +355,15 @@ struct cpsw_priv { | |||
355 | #define napi_to_priv(napi) container_of(napi, struct cpsw_priv, napi) | 355 | #define napi_to_priv(napi) container_of(napi, struct cpsw_priv, napi) |
356 | #define for_each_slave(priv, func, arg...) \ | 356 | #define for_each_slave(priv, func, arg...) \ |
357 | do { \ | 357 | do { \ |
358 | int idx; \ | 358 | struct cpsw_slave *slave; \ |
359 | int n; \ | ||
359 | if (priv->data.dual_emac) \ | 360 | if (priv->data.dual_emac) \ |
360 | (func)((priv)->slaves + priv->emac_port, ##arg);\ | 361 | (func)((priv)->slaves + priv->emac_port, ##arg);\ |
361 | else \ | 362 | else \ |
362 | for (idx = 0; idx < (priv)->data.slaves; idx++) \ | 363 | for (n = (priv)->data.slaves, \ |
363 | (func)((priv)->slaves + idx, ##arg); \ | 364 | slave = (priv)->slaves; \ |
365 | n; n--) \ | ||
366 | (func)(slave++, ##arg); \ | ||
364 | } while (0) | 367 | } while (0) |
365 | #define cpsw_get_slave_ndev(priv, __slave_no__) \ | 368 | #define cpsw_get_slave_ndev(priv, __slave_no__) \ |
366 | (priv->slaves[__slave_no__].ndev) | 369 | (priv->slaves[__slave_no__].ndev) |