net: treewide use of RCU_INIT_POINTER
authorEric Dumazet <eric.dumazet@gmail.com>
Wed, 23 Nov 2011 07:09:32 +0000 (07:09 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Nov 2011 23:48:19 +0000 (18:48 -0500)
rcu_assign_pointer(ptr, NULL) can be safely replaced by
RCU_INIT_POINTER(ptr, NULL)

(old rcu_assign_pointer() macro was testing the NULL value and could
omit the smp_wmb(), but this had to be removed because of compiler
warnings)

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
drivers/net/ethernet/broadcom/cnic.c
drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
drivers/net/macvtap.c
drivers/net/ppp/pptp.c
drivers/net/team/team_mode_activebackup.c
drivers/net/wireless/ath/carl9170/main.c
net/core/netprio_cgroup.c

index 83d8cefba8c089b55ffb6f57559a5cd9afcbca22..d573169279b7f45bbbb7d18abf0386f7a37215f0 100644 (file)
@@ -409,7 +409,7 @@ static int bnx2_unregister_cnic(struct net_device *dev)
        mutex_lock(&bp->cnic_lock);
        cp->drv_state = 0;
        bnapi->cnic_present = 0;
-       rcu_assign_pointer(bp->cnic_ops, NULL);
+       RCU_INIT_POINTER(bp->cnic_ops, NULL);
        mutex_unlock(&bp->cnic_lock);
        synchronize_rcu();
        return 0;
index 83481e20f144f2f3ad0801f78d649a8e909cbe70..0cdbb70ef83e43e9e61006ff056b4fc0840a3e8c 100644 (file)
@@ -11587,7 +11587,7 @@ static int bnx2x_unregister_cnic(struct net_device *dev)
 
        mutex_lock(&bp->cnic_mutex);
        cp->drv_state = 0;
-       rcu_assign_pointer(bp->cnic_ops, NULL);
+       RCU_INIT_POINTER(bp->cnic_ops, NULL);
        mutex_unlock(&bp->cnic_mutex);
        synchronize_rcu();
        kfree(bp->cnic_kwq);
index 099f41d99ec058d9506aa134b3a74140949ac2fb..b336e55e0d80bcbe0104af8e6ab243943616ec7e 100644 (file)
@@ -506,7 +506,7 @@ int cnic_unregister_driver(int ulp_type)
        }
        read_unlock(&cnic_dev_lock);
 
-       rcu_assign_pointer(cnic_ulp_tbl[ulp_type], NULL);
+       RCU_INIT_POINTER(cnic_ulp_tbl[ulp_type], NULL);
 
        mutex_unlock(&cnic_lock);
        synchronize_rcu();
@@ -579,7 +579,7 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
        }
        mutex_lock(&cnic_lock);
        if (rcu_dereference(cp->ulp_ops[ulp_type])) {
-               rcu_assign_pointer(cp->ulp_ops[ulp_type], NULL);
+               RCU_INIT_POINTER(cp->ulp_ops[ulp_type], NULL);
                cnic_put(dev);
        } else {
                pr_err("%s: device not registered to this ulp type %d\n",
@@ -5134,7 +5134,7 @@ static void cnic_stop_hw(struct cnic_dev *dev)
                }
                cnic_shutdown_rings(dev);
                clear_bit(CNIC_F_CNIC_UP, &dev->flags);
-               rcu_assign_pointer(cp->ulp_ops[CNIC_ULP_L4], NULL);
+               RCU_INIT_POINTER(cp->ulp_ops[CNIC_ULP_L4], NULL);
                synchronize_rcu();
                cnic_cm_shutdown(dev);
                cp->stop_hw(dev);
index 90ff1318cc05fbc5ed0e08141962d8a87140c74f..7f7882d24bc6081258d276d164c429c188df6b44 100644 (file)
@@ -1301,7 +1301,7 @@ int cxgb3_offload_activate(struct adapter *adapter)
 
 out_free_l2t:
        t3_free_l2t(L2DATA(dev));
-       rcu_assign_pointer(dev->l2opt, NULL);
+       RCU_INIT_POINTER(dev->l2opt, NULL);
 out_free:
        kfree(t);
        return err;
@@ -1329,7 +1329,7 @@ void cxgb3_offload_deactivate(struct adapter *adapter)
        rcu_read_lock();
        d = L2DATA(tdev);
        rcu_read_unlock();
-       rcu_assign_pointer(tdev->l2opt, NULL);
+       RCU_INIT_POINTER(tdev->l2opt, NULL);
        call_rcu(&d->rcu_head, clean_l2_data);
        if (t->nofail_skb)
                kfree_skb(t->nofail_skb);
index 1b7082d08f334b8d1d0ab7f350bb2de5a3d41c5c..7c88d136e72353f13c926fd1437d49fa0bacb54e 100644 (file)
@@ -145,8 +145,8 @@ static void macvtap_put_queue(struct macvtap_queue *q)
        if (vlan) {
                int index = get_slot(vlan, q);
 
-               rcu_assign_pointer(vlan->taps[index], NULL);
-               rcu_assign_pointer(q->vlan, NULL);
+               RCU_INIT_POINTER(vlan->taps[index], NULL);
+               RCU_INIT_POINTER(q->vlan, NULL);
                sock_put(&q->sk);
                --vlan->numvtaps;
        }
@@ -223,8 +223,8 @@ static void macvtap_del_queues(struct net_device *dev)
                                              lockdep_is_held(&macvtap_lock));
                if (q) {
                        qlist[j++] = q;
-                       rcu_assign_pointer(vlan->taps[i], NULL);
-                       rcu_assign_pointer(q->vlan, NULL);
+                       RCU_INIT_POINTER(vlan->taps[i], NULL);
+                       RCU_INIT_POINTER(q->vlan, NULL);
                        vlan->numvtaps--;
                }
        }
index 89f829f5f7257fcacd54902d3963520ab5b47525..ede899ca0ee6dfc6397ea1d9838967caa43f7f3c 100644 (file)
@@ -162,7 +162,7 @@ static void del_chan(struct pppox_sock *sock)
 {
        spin_lock(&chan_lock);
        clear_bit(sock->proto.pptp.src_addr.call_id, callid_bitmap);
-       rcu_assign_pointer(callid_sock[sock->proto.pptp.src_addr.call_id], NULL);
+       RCU_INIT_POINTER(callid_sock[sock->proto.pptp.src_addr.call_id], NULL);
        spin_unlock(&chan_lock);
        synchronize_rcu();
 }
index b34427502b544cdb5289d89e027221de85b5767c..f4d960e82e2967561e16a397c44c89312a556222 100644 (file)
@@ -56,7 +56,7 @@ drop:
 static void ab_port_leave(struct team *team, struct team_port *port)
 {
        if (ab_priv(team)->active_port == port)
-               rcu_assign_pointer(ab_priv(team)->active_port, NULL);
+               RCU_INIT_POINTER(ab_priv(team)->active_port, NULL);
 }
 
 static int ab_active_port_get(struct team *team, void *arg)
index f06e0695d412fb9631117d6261608834a4376eb9..551859214ee9486d34aba1315bc29cdf7ef02abf 100644 (file)
@@ -446,7 +446,7 @@ static void carl9170_op_stop(struct ieee80211_hw *hw)
 
        mutex_lock(&ar->mutex);
        if (IS_ACCEPTING_CMD(ar)) {
-               rcu_assign_pointer(ar->beacon_iter, NULL);
+               RCU_INIT_POINTER(ar->beacon_iter, NULL);
 
                carl9170_led_set_state(ar, 0);
 
@@ -678,7 +678,7 @@ unlock:
                vif_priv->active = false;
                bitmap_release_region(&ar->vif_bitmap, vif_id, 0);
                ar->vifs--;
-               rcu_assign_pointer(ar->vif_priv[vif_id].vif, NULL);
+               RCU_INIT_POINTER(ar->vif_priv[vif_id].vif, NULL);
                list_del_rcu(&vif_priv->list);
                mutex_unlock(&ar->mutex);
                synchronize_rcu();
@@ -716,7 +716,7 @@ static void carl9170_op_remove_interface(struct ieee80211_hw *hw,
        WARN_ON(vif_priv->enable_beacon);
        vif_priv->enable_beacon = false;
        list_del_rcu(&vif_priv->list);
-       rcu_assign_pointer(ar->vif_priv[id].vif, NULL);
+       RCU_INIT_POINTER(ar->vif_priv[id].vif, NULL);
 
        if (vif == main_vif) {
                rcu_read_unlock();
@@ -1258,7 +1258,7 @@ static int carl9170_op_sta_add(struct ieee80211_hw *hw,
                }
 
                for (i = 0; i < CARL9170_NUM_TID; i++)
-                       rcu_assign_pointer(sta_info->agg[i], NULL);
+                       RCU_INIT_POINTER(sta_info->agg[i], NULL);
 
                sta_info->ampdu_max_len = 1 << (3 + sta->ht_cap.ampdu_factor);
                sta_info->ht_sta = true;
@@ -1285,7 +1285,7 @@ static int carl9170_op_sta_remove(struct ieee80211_hw *hw,
                        struct carl9170_sta_tid *tid_info;
 
                        tid_info = rcu_dereference(sta_info->agg[i]);
-                       rcu_assign_pointer(sta_info->agg[i], NULL);
+                       RCU_INIT_POINTER(sta_info->agg[i], NULL);
 
                        if (!tid_info)
                                continue;
@@ -1398,7 +1398,7 @@ static int carl9170_op_ampdu_action(struct ieee80211_hw *hw,
                        spin_unlock_bh(&ar->tx_ampdu_list_lock);
                }
 
-               rcu_assign_pointer(sta_info->agg[tid], NULL);
+               RCU_INIT_POINTER(sta_info->agg[tid], NULL);
                rcu_read_unlock();
 
                ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
index 72ad0bc6841ef8ce1d737230283eee8c98b95890..3a9fd4826b75da9c6c11157f17db2c4d04f76bd5 100644 (file)
@@ -285,7 +285,7 @@ static int netprio_device_event(struct notifier_block *unused,
                break;
        case NETDEV_UNREGISTER:
                old = rtnl_dereference(dev->priomap);
-               rcu_assign_pointer(dev->priomap, NULL);
+               RCU_INIT_POINTER(dev->priomap, NULL);
                if (old)
                        kfree_rcu(old, rcu);
                break;
@@ -332,7 +332,7 @@ static void __exit exit_cgroup_netprio(void)
        rtnl_lock();
        for_each_netdev(&init_net, dev) {
                old = rtnl_dereference(dev->priomap);
-               rcu_assign_pointer(dev->priomap, NULL);
+               RCU_INIT_POINTER(dev->priomap, NULL);
                if (old)
                        kfree_rcu(old, rcu);
        }