ALSA: usb-audio: add support for Akai MPD16
[safe/jmp/linux-2.6] / net / ipv6 / anycast.c
index ae494e3..b5b0705 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/init.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <linux/slab.h>
 
 #include <net/net_namespace.h>
 #include <net/sock.h>
@@ -404,13 +405,13 @@ int ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
 
        if (dev)
                return ipv6_chk_acast_dev(dev, addr);
-       read_lock(&dev_base_lock);
-       for_each_netdev(net, dev)
+       rcu_read_lock();
+       for_each_netdev_rcu(net, dev)
                if (ipv6_chk_acast_dev(dev, addr)) {
                        found = 1;
                        break;
                }
-       read_unlock(&dev_base_lock);
+       rcu_read_unlock();
        return found;
 }
 
@@ -431,9 +432,9 @@ static inline struct ifacaddr6 *ac6_get_first(struct seq_file *seq)
        struct net *net = seq_file_net(seq);
 
        state->idev = NULL;
-       for_each_netdev(net, state->dev) {
+       for_each_netdev_rcu(net, state->dev) {
                struct inet6_dev *idev;
-               idev = in6_dev_get(state->dev);
+               idev = __in6_dev_get(state->dev);
                if (!idev)
                        continue;
                read_lock_bh(&idev->lock);
@@ -443,7 +444,6 @@ static inline struct ifacaddr6 *ac6_get_first(struct seq_file *seq)
                        break;
                }
                read_unlock_bh(&idev->lock);
-               in6_dev_put(idev);
        }
        return im;
 }
@@ -454,16 +454,15 @@ static struct ifacaddr6 *ac6_get_next(struct seq_file *seq, struct ifacaddr6 *im
 
        im = im->aca_next;
        while (!im) {
-               if (likely(state->idev != NULL)) {
+               if (likely(state->idev != NULL))
                        read_unlock_bh(&state->idev->lock);
-                       in6_dev_put(state->idev);
-               }
-               state->dev = next_net_device(state->dev);
+
+               state->dev = next_net_device_rcu(state->dev);
                if (!state->dev) {
                        state->idev = NULL;
                        break;
                }
-               state->idev = in6_dev_get(state->dev);
+               state->idev = __in6_dev_get(state->dev);
                if (!state->idev)
                        continue;
                read_lock_bh(&state->idev->lock);
@@ -482,29 +481,30 @@ static struct ifacaddr6 *ac6_get_idx(struct seq_file *seq, loff_t pos)
 }
 
 static void *ac6_seq_start(struct seq_file *seq, loff_t *pos)
-       __acquires(dev_base_lock)
+       __acquires(RCU)
 {
-       read_lock(&dev_base_lock);
+       rcu_read_lock();
        return ac6_get_idx(seq, *pos);
 }
 
 static void *ac6_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
-       struct ifacaddr6 *im;
-       im = ac6_get_next(seq, v);
+       struct ifacaddr6 *im = ac6_get_next(seq, v);
+
        ++*pos;
        return im;
 }
 
 static void ac6_seq_stop(struct seq_file *seq, void *v)
-       __releases(dev_base_lock)
+       __releases(RCU)
 {
        struct ac6_iter_state *state = ac6_seq_private(seq);
+
        if (likely(state->idev != NULL)) {
                read_unlock_bh(&state->idev->lock);
-               in6_dev_put(state->idev);
+               state->idev = NULL;
        }
-       read_unlock(&dev_base_lock);
+       rcu_read_unlock();
 }
 
 static int ac6_seq_show(struct seq_file *seq, void *v)
@@ -512,7 +512,7 @@ static int ac6_seq_show(struct seq_file *seq, void *v)
        struct ifacaddr6 *im = (struct ifacaddr6 *)v;
        struct ac6_iter_state *state = ac6_seq_private(seq);
 
-       seq_printf(seq, "%-4d %-15s %#p6 %5d\n",
+       seq_printf(seq, "%-4d %-15s %pi6 %5d\n",
                   state->dev->ifindex, state->dev->name,
                   &im->aca_addr, im->aca_users);
        return 0;
@@ -539,7 +539,7 @@ static const struct file_operations ac6_seq_fops = {
        .release        =       seq_release_net,
 };
 
-int ac6_proc_init(struct net *net)
+int __net_init ac6_proc_init(struct net *net)
 {
        if (!proc_net_fops_create(net, "anycast6", S_IRUGO, &ac6_seq_fops))
                return -ENOMEM;