[PATCH] spinlock consolidation
[pandora-kernel.git] / net / core / netpoll.c
index c02a08d..5265dfd 100644 (file)
@@ -357,7 +357,6 @@ static void arp_reply(struct sk_buff *skb)
        unsigned char *arp_ptr;
        int size, type = ARPOP_REPLY, ptype = ETH_P_ARP;
        u32 sip, tip;
-       unsigned long flags;
        struct sk_buff *send_skb;
        struct netpoll *np = NULL;
 
@@ -646,10 +645,10 @@ int netpoll_setup(struct netpoll *np)
 
                npinfo->rx_flags = 0;
                npinfo->rx_np = NULL;
-               npinfo->poll_lock = SPIN_LOCK_UNLOCKED;
+               spin_lock_init(&npinfo->poll_lock);
                npinfo->poll_owner = -1;
                npinfo->tries = MAX_RETRIES;
-               npinfo->rx_lock = SPIN_LOCK_UNLOCKED;
+               spin_lock_init(&npinfo->rx_lock);
        } else
                npinfo = ndev->npinfo;
 
@@ -732,6 +731,9 @@ int netpoll_setup(struct netpoll *np)
        /* last thing to do is link it to the net device structure */
        ndev->npinfo = npinfo;
 
+       /* avoid racing with NAPI reading npinfo */
+       synchronize_rcu();
+
        return 0;
 
  release: