]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv6/anycast.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/herbert/crypto-2.6
[linux-2.6-omap-h63xx.git] / net / ipv6 / anycast.c
index 6fb2e9d716c004ec6d0b0c83263fd76878c3450c..b8c533fbdb63f0ab320b7d27735f2e5a6ea2b040 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/string.h>
 #include <linux/socket.h>
 #include <linux/sockios.h>
-#include <linux/sched.h>
 #include <linux/net.h>
 #include <linux/in6.h>
 #include <linux/netdevice.h>
@@ -424,14 +423,18 @@ static int ipv6_chk_acast_dev(struct net_device *dev, struct in6_addr *addr)
  */
 int ipv6_chk_acast_addr(struct net_device *dev, struct in6_addr *addr)
 {
+       int found = 0;
+
        if (dev)
                return ipv6_chk_acast_dev(dev, addr);
        read_lock(&dev_base_lock);
-       for (dev=dev_base; dev; dev=dev->next)
-               if (ipv6_chk_acast_dev(dev, addr))
+       for_each_netdev(dev)
+               if (ipv6_chk_acast_dev(dev, addr)) {
+                       found = 1;
                        break;
+               }
        read_unlock(&dev_base_lock);
-       return dev != 0;
+       return found;
 }
 
 
@@ -448,9 +451,8 @@ static inline struct ifacaddr6 *ac6_get_first(struct seq_file *seq)
        struct ifacaddr6 *im = NULL;
        struct ac6_iter_state *state = ac6_seq_private(seq);
 
-       for (state->dev = dev_base, state->idev = NULL;
-            state->dev;
-            state->dev = state->dev->next) {
+       state->idev = NULL;
+       for_each_netdev(state->dev) {
                struct inet6_dev *idev;
                idev = in6_dev_get(state->dev);
                if (!idev)
@@ -462,6 +464,7 @@ static inline struct ifacaddr6 *ac6_get_first(struct seq_file *seq)
                        break;
                }
                read_unlock_bh(&idev->lock);
+               in6_dev_put(idev);
        }
        return im;
 }
@@ -476,7 +479,7 @@ static struct ifacaddr6 *ac6_get_next(struct seq_file *seq, struct ifacaddr6 *im
                        read_unlock_bh(&state->idev->lock);
                        in6_dev_put(state->idev);
                }
-               state->dev = state->dev->next;
+               state->dev = next_net_device(state->dev);
                if (!state->dev) {
                        state->idev = NULL;
                        break;
@@ -536,7 +539,7 @@ static int ac6_seq_show(struct seq_file *seq, void *v)
        return 0;
 }
 
-static struct seq_operations ac6_seq_ops = {
+static const struct seq_operations ac6_seq_ops = {
        .start  =       ac6_seq_start,
        .next   =       ac6_seq_next,
        .stop   =       ac6_seq_stop,