diff options
author | Sebastian Siewior <bigeasy@linutronix.de> | 2013-04-24 08:48:24 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-25 04:12:29 -0400 |
commit | 6e6ceaedb5901c7ebd23e5222726dab5362938bd (patch) | |
tree | 39730834b9fb17999018c1aba50e6471754774c4 | |
parent | d1bd9acfa3419dc9d5c32589b34a370ca6ae100e (diff) | |
download | blackbird-obmc-linux-6e6ceaedb5901c7ebd23e5222726dab5362938bd.tar.gz blackbird-obmc-linux-6e6ceaedb5901c7ebd23e5222726dab5362938bd.zip |
net/cpsw: optimize the for_each_slave_macro()
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>
-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 { #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) |