Skip to content

Commit

Permalink
net/cpsw: optimize the for_each_slave_macro()
Browse files Browse the repository at this point in the history
text    data     bss     dec     hex filename
15530      92       4   15626    3d0a cpsw.o.before
15478      92       4   15574    3cd6 cpsw.o.after

52 bytes smaller, 13 for each invocation.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sebastian Siewior authored and David S. Miller committed Apr 25, 2013
1 parent d1bd9ac commit 6e6ceae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/net/ethernet/ti/cpsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,15 @@ struct cpsw_priv {
#define napi_to_priv(napi) container_of(napi, struct cpsw_priv, napi)
#define for_each_slave(priv, func, arg...) \
do { \
int idx; \
struct cpsw_slave *slave; \
int n; \
if (priv->data.dual_emac) \
(func)((priv)->slaves + priv->emac_port, ##arg);\
else \
for (idx = 0; idx < (priv)->data.slaves; idx++) \
(func)((priv)->slaves + idx, ##arg); \
for (n = (priv)->data.slaves, \
slave = (priv)->slaves; \
n; n--) \
(func)(slave++, ##arg); \
} while (0)
#define cpsw_get_slave_ndev(priv, __slave_no__) \
(priv->slaves[__slave_no__].ndev)
Expand Down

0 comments on commit 6e6ceae

Please sign in to comment.