aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPavel Emelianov <xemul@openvz.org>2007-05-03 18:13:45 -0400
committerDavid S. Miller <davem@davemloft.net>2007-05-03 18:13:45 -0400
commit7562f876cd93800f2f8c89445f2a563590b24e09 (patch)
tree78a34c011af275efa0d55ba59c3bd49b771dd533 /drivers
parent03fba0479600114f32d29eee74ca3eaa364606bf (diff)
[NET]: Rework dev_base via list_head (v3)
Cleanup of dev_base list use, with the aim to simplify making device list per-namespace. In almost every occasion, use of dev_base variable and dev->next pointer could be easily replaced by for_each_netdev loop. A few most complicated places were converted to using first_netdev()/next_netdev(). Signed-off-by: Pavel Emelianov <xemul@openvz.org> Acked-by: Kirill Korotaev <dev@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/aoe/aoecmd.c8
-rw-r--r--drivers/net/wireless/strip.c4
-rw-r--r--drivers/parisc/led.c2
3 files changed, 7 insertions, 7 deletions
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 1a6aeac5a1c3..01fbdd38e3be 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -194,15 +194,15 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
194 sl = sl_tail = NULL; 194 sl = sl_tail = NULL;
195 195
196 read_lock(&dev_base_lock); 196 read_lock(&dev_base_lock);
197 for (ifp = dev_base; ifp; dev_put(ifp), ifp = ifp->next) { 197 for_each_netdev(ifp) {
198 dev_hold(ifp); 198 dev_hold(ifp);
199 if (!is_aoe_netif(ifp)) 199 if (!is_aoe_netif(ifp))
200 continue; 200 goto cont;
201 201
202 skb = new_skb(sizeof *h + sizeof *ch); 202 skb = new_skb(sizeof *h + sizeof *ch);
203 if (skb == NULL) { 203 if (skb == NULL) {
204 printk(KERN_INFO "aoe: skb alloc failure\n"); 204 printk(KERN_INFO "aoe: skb alloc failure\n");
205 continue; 205 goto cont;
206 } 206 }
207 skb_put(skb, sizeof *h + sizeof *ch); 207 skb_put(skb, sizeof *h + sizeof *ch);
208 skb->dev = ifp; 208 skb->dev = ifp;
@@ -221,6 +221,8 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
221 221
222 skb->next = sl; 222 skb->next = sl;
223 sl = skb; 223 sl = skb;
224cont:
225 dev_put(ifp);
224 } 226 }
225 read_unlock(&dev_base_lock); 227 read_unlock(&dev_base_lock);
226 228
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index 2a299a0676a6..ef32a5c1e818 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -1971,8 +1971,7 @@ static struct net_device *get_strip_dev(struct strip *strip_info)
1971 sizeof(zero_address))) { 1971 sizeof(zero_address))) {
1972 struct net_device *dev; 1972 struct net_device *dev;
1973 read_lock_bh(&dev_base_lock); 1973 read_lock_bh(&dev_base_lock);
1974 dev = dev_base; 1974 for_each_netdev(dev) {
1975 while (dev) {
1976 if (dev->type == strip_info->dev->type && 1975 if (dev->type == strip_info->dev->type &&
1977 !memcmp(dev->dev_addr, 1976 !memcmp(dev->dev_addr,
1978 &strip_info->true_dev_addr, 1977 &strip_info->true_dev_addr,
@@ -1983,7 +1982,6 @@ static struct net_device *get_strip_dev(struct strip *strip_info)
1983 read_unlock_bh(&dev_base_lock); 1982 read_unlock_bh(&dev_base_lock);
1984 return (dev); 1983 return (dev);
1985 } 1984 }
1986 dev = dev->next;
1987 } 1985 }
1988 read_unlock_bh(&dev_base_lock); 1986 read_unlock_bh(&dev_base_lock);
1989 } 1987 }
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
index 3df82fe9ce8c..98be2880757d 100644
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -365,7 +365,7 @@ static __inline__ int led_get_net_activity(void)
365 * for reading should be OK */ 365 * for reading should be OK */
366 read_lock(&dev_base_lock); 366 read_lock(&dev_base_lock);
367 rcu_read_lock(); 367 rcu_read_lock();
368 for (dev = dev_base; dev; dev = dev->next) { 368 for_each_netdev(dev) {
369 struct net_device_stats *stats; 369 struct net_device_stats *stats;
370 struct in_device *in_dev = __in_dev_get_rcu(dev); 370 struct in_device *in_dev = __in_dev_get_rcu(dev);
371 if (!in_dev || !in_dev->ifa_list) 371 if (!in_dev || !in_dev->ifa_list)