[PATCH] zd1211rw: Add ID for Planex GW-US54Mini
[powerpc.git] / drivers / net / hamradio / bpqether.c
index 1756f0e..889f338 100644 (file)
@@ -54,7 +54,6 @@
  *     BPQ   004       Joerg(DL1BKE)           Fixed to not lock up on ifconfig.
  */
 
-#include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/socket.h>
@@ -123,6 +122,12 @@ struct bpqdev {
 
 static LIST_HEAD(bpq_devices);
 
+/*
+ * bpqether network devices are paired with ethernet devices below them, so
+ * form a special "super class" of normal ethernet devices; split their locks
+ * off into a separate class since they always nest.
+ */
+static struct lock_class_key bpq_netdev_xmit_lock_key;
 
 /* ------------------------------------------------------------------------ */
 
@@ -144,7 +149,7 @@ static inline struct net_device *bpq_get_ax25_dev(struct net_device *dev)
 {
        struct bpqdev *bpq;
 
-       list_for_each_entry(bpq, &bpq_devices, bpq_list) {
+       list_for_each_entry_rcu(bpq, &bpq_devices, bpq_list) {
                if (bpq->ethdev == dev)
                        return bpq->axdev;
        }
@@ -399,7 +404,7 @@ static void *bpq_seq_start(struct seq_file *seq, loff_t *pos)
        if (*pos == 0)
                return SEQ_START_TOKEN;
        
-       list_for_each_entry(bpqdev, &bpq_devices, bpq_list) {
+       list_for_each_entry_rcu(bpqdev, &bpq_devices, bpq_list) {
                if (i == *pos)
                        return bpqdev;
        }
@@ -418,7 +423,7 @@ static void *bpq_seq_next(struct seq_file *seq, void *v, loff_t *pos)
                p = ((struct bpqdev *)v)->bpq_list.next;
 
        return (p == &bpq_devices) ? NULL 
-               : list_entry(p, struct bpqdev, bpq_list);
+               : rcu_dereference(list_entry(p, struct bpqdev, bpq_list));
 }
 
 static void bpq_seq_stop(struct seq_file *seq, void *v)
@@ -529,6 +534,7 @@ static int bpq_new_device(struct net_device *edev)
        err = register_netdevice(ndev);
        if (err)
                goto error;
+       lockdep_set_class(&ndev->_xmit_lock, &bpq_netdev_xmit_lock_key);
 
        /* List protected by RTNL */
        list_add_rcu(&bpq->bpq_list, &bpq_devices);
@@ -561,8 +567,6 @@ static int bpq_device_event(struct notifier_block *this,unsigned long event, voi
        if (!dev_is_ethdev(dev))
                return NOTIFY_DONE;
 
-       rcu_read_lock();
-
        switch (event) {
        case NETDEV_UP:         /* new ethernet device -> new BPQ interface */
                if (bpq_get_ax25_dev(dev) == NULL)
@@ -581,7 +585,6 @@ static int bpq_device_event(struct notifier_block *this,unsigned long event, voi
        default:
                break;
        }
-       rcu_read_unlock();
 
        return NOTIFY_DONE;
 }