Cleanup of net_device list use in arch-dependent code and block devices. The cleanup consists of - converting the to list_head, to make the list double-linked (thus making remove operation O(1)), and list walks more readable; - introducing of for_each_netdev wrapper over list_for_each.
Signed-off-by: Andrey Savochkin <[EMAIL PROTECTED]> --- arch/s390/appldata/appldata_net_sum.c | 2 +- arch/sparc64/solaris/ioctl.c | 2 +- drivers/block/aoe/aoecmd.c | 8 ++++++-- drivers/parisc/led.c | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) --- ./arch/s390/appldata/appldata_net_sum.c.vedevbase-misc Mon Jul 3 15:13:15 2006 +++ ./arch/s390/appldata/appldata_net_sum.c Mon Jul 3 16:16:05 2006 @@ -107,7 +107,7 @@ static void appldata_get_net_sum_data(vo tx_dropped = 0; collisions = 0; read_lock(&dev_base_lock); - for (dev = dev_base; dev != NULL; dev = dev->next) { + for_each_netdev(dev) { if (dev->get_stats == NULL) { continue; } --- ./arch/sparc64/solaris/ioctl.c.vedevbase-misc Mon Mar 20 08:53:29 2006 +++ ./arch/sparc64/solaris/ioctl.c Mon Jul 3 16:16:05 2006 @@ -686,7 +686,7 @@ static inline int solaris_i(unsigned int int i = 0; read_lock_bh(&dev_base_lock); - for (d = dev_base; d; d = d->next) i++; + for_each_netdev(d) i++; read_unlock_bh(&dev_base_lock); if (put_user (i, (int __user *)A(arg))) --- ./drivers/block/aoe/aoecmd.c.vedevbase-misc Mon Jul 3 15:09:57 2006 +++ ./drivers/block/aoe/aoecmd.c Mon Jul 3 16:16:05 2006 @@ -204,14 +204,17 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigne sl = sl_tail = NULL; read_lock(&dev_base_lock); - for (ifp = dev_base; ifp; dev_put(ifp), ifp = ifp->next) { + for_each_netdev(ifp) { dev_hold(ifp); - if (!is_aoe_netif(ifp)) + if (!is_aoe_netif(ifp)) { + dev_put(ifp); continue; + } skb = new_skb(ifp, sizeof *h + sizeof *ch); if (skb == NULL) { printk(KERN_INFO "aoe: aoecmd_cfg: skb alloc failure\n"); + dev_put(ifp); continue; } if (sl_tail == NULL) @@ -229,6 +232,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigne skb->next = sl; sl = skb; + dev_put(ifp); } read_unlock(&dev_base_lock); --- ./drivers/parisc/led.c.vedevbase-misc Mon Jul 3 15:13:46 2006 +++ ./drivers/parisc/led.c Mon Jul 3 16:16:05 2006 @@ -367,7 +367,7 @@ static __inline__ int led_get_net_activi * for reading should be OK */ read_lock(&dev_base_lock); rcu_read_lock(); - for (dev = dev_base; dev; dev = dev->next) { + for_each_netdev(dev) { struct net_device_stats *stats; struct in_device *in_dev = __in_dev_get_rcu(dev); if (!in_dev || !in_dev->ifa_list) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html