Skip to content

Commit a9b3cd7

Browse files
Stephen Hemmingerdavem330
authored andcommitted
rcu: convert uses of rcu_assign_pointer(x, NULL) to RCU_INIT_POINTER
When assigning a NULL value to an RCU protected pointer, no barrier is needed. The rcu_assign_pointer, used to handle that but will soon change to not handle the special case. Convert all rcu_assign_pointer of NULL value. //smpl @@ expression P; @@ - rcu_assign_pointer(P, NULL) + RCU_INIT_POINTER(P, NULL) // </smpl> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 76f793e commit a9b3cd7

55 files changed

Lines changed: 193 additions & 193 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎net/802/garp.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ static void garp_release_port(struct net_device *dev)
553553
if (rtnl_dereference(port->applicants[i]))
554554
return;
555555
}
556-
rcu_assign_pointer(dev->garp_port, NULL);
556+
RCU_INIT_POINTER(dev->garp_port, NULL);
557557
kfree_rcu(port, rcu);
558558
}
559559

@@ -605,7 +605,7 @@ void garp_uninit_applicant(struct net_device *dev, struct garp_application *appl
605605

606606
ASSERT_RTNL();
607607

608-
rcu_assign_pointer(port->applicants[appl->type], NULL);
608+
RCU_INIT_POINTER(port->applicants[appl->type], NULL);
609609

610610
/* Delete timer and generate a final TRANSMIT_PDU event to flush out
611611
* all pending messages before the applicant is gone. */

‎net/802/stp.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ void stp_proto_unregister(const struct stp_proto *proto)
8888
{
8989
mutex_lock(&stp_proto_mutex);
9090
if (is_zero_ether_addr(proto->group_address))
91-
rcu_assign_pointer(stp_proto, NULL);
91+
RCU_INIT_POINTER(stp_proto, NULL);
9292
else
93-
rcu_assign_pointer(garp_protos[proto->group_address[5] -
93+
RCU_INIT_POINTER(garp_protos[proto->group_address[5] -
9494
GARP_ADDR_MIN], NULL);
9595
synchronize_rcu();
9696

‎net/8021q/vlan.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head)
133133
if (grp->nr_vlans == 0) {
134134
vlan_gvrp_uninit_applicant(real_dev);
135135

136-
rcu_assign_pointer(real_dev->vlgrp, NULL);
136+
RCU_INIT_POINTER(real_dev->vlgrp, NULL);
137137

138138
/* Free the group, after all cpu's are done. */
139139
call_rcu(&grp->rcu, vlan_rcu_free);

‎net/bridge/netfilter/ebtable_broute.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ static int __init ebtable_broute_init(void)
8787
if (ret < 0)
8888
return ret;
8989
/* see br_input.c */
90-
rcu_assign_pointer(br_should_route_hook,
90+
RCU_INIT_POINTER(br_should_route_hook,
9191
(br_should_route_hook_t *)ebt_broute);
9292
return 0;
9393
}
9494

9595
static void __exit ebtable_broute_fini(void)
9696
{
97-
rcu_assign_pointer(br_should_route_hook, NULL);
97+
RCU_INIT_POINTER(br_should_route_hook, NULL);
9898
synchronize_net();
9999
unregister_pernet_subsys(&broute_net_ops);
100100
}

‎net/caif/cfmuxl.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ struct cflayer *cfmuxl_remove_dnlayer(struct cflayer *layr, u8 phyid)
108108
int idx = phyid % DN_CACHE_SIZE;
109109

110110
spin_lock_bh(&muxl->transmit_lock);
111-
rcu_assign_pointer(muxl->dn_cache[idx], NULL);
111+
RCU_INIT_POINTER(muxl->dn_cache[idx], NULL);
112112
dn = get_from_id(&muxl->frml_list, phyid);
113113
if (dn == NULL)
114114
goto out;
@@ -164,7 +164,7 @@ struct cflayer *cfmuxl_remove_uplayer(struct cflayer *layr, u8 id)
164164
if (up == NULL)
165165
goto out;
166166

167-
rcu_assign_pointer(muxl->up_cache[idx], NULL);
167+
RCU_INIT_POINTER(muxl->up_cache[idx], NULL);
168168
list_del_rcu(&up->node);
169169
out:
170170
spin_unlock_bh(&muxl->receive_lock);
@@ -261,7 +261,7 @@ static void cfmuxl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl,
261261

262262
idx = layer->id % UP_CACHE_SIZE;
263263
spin_lock_bh(&muxl->receive_lock);
264-
rcu_assign_pointer(muxl->up_cache[idx], NULL);
264+
RCU_INIT_POINTER(muxl->up_cache[idx], NULL);
265265
list_del_rcu(&layer->node);
266266
spin_unlock_bh(&muxl->receive_lock);
267267
}

‎net/can/af_can.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ int can_proto_register(const struct can_proto *cp)
719719
proto);
720720
err = -EBUSY;
721721
} else
722-
rcu_assign_pointer(proto_tab[proto], cp);
722+
RCU_INIT_POINTER(proto_tab[proto], cp);
723723

724724
mutex_unlock(&proto_tab_lock);
725725

@@ -740,7 +740,7 @@ void can_proto_unregister(const struct can_proto *cp)
740740

741741
mutex_lock(&proto_tab_lock);
742742
BUG_ON(proto_tab[proto] != cp);
743-
rcu_assign_pointer(proto_tab[proto], NULL);
743+
RCU_INIT_POINTER(proto_tab[proto], NULL);
744744
mutex_unlock(&proto_tab_lock);
745745

746746
synchronize_rcu();

‎net/core/dev.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3094,8 +3094,8 @@ void netdev_rx_handler_unregister(struct net_device *dev)
30943094
{
30953095

30963096
ASSERT_RTNL();
3097-
rcu_assign_pointer(dev->rx_handler, NULL);
3098-
rcu_assign_pointer(dev->rx_handler_data, NULL);
3097+
RCU_INIT_POINTER(dev->rx_handler, NULL);
3098+
RCU_INIT_POINTER(dev->rx_handler_data, NULL);
30993099
}
31003100
EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister);
31013101

‎net/core/fib_rules.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
487487
if (ops->nr_goto_rules > 0) {
488488
list_for_each_entry(tmp, &ops->rules_list, list) {
489489
if (rtnl_dereference(tmp->ctarget) == rule) {
490-
rcu_assign_pointer(tmp->ctarget, NULL);
490+
RCU_INIT_POINTER(tmp->ctarget, NULL);
491491
ops->unresolved_rules++;
492492
}
493493
}

‎net/core/filter.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ int sk_detach_filter(struct sock *sk)
645645
filter = rcu_dereference_protected(sk->sk_filter,
646646
sock_owned_by_user(sk));
647647
if (filter) {
648-
rcu_assign_pointer(sk->sk_filter, NULL);
648+
RCU_INIT_POINTER(sk->sk_filter, NULL);
649649
sk_filter_uncharge(sk, filter);
650650
ret = 0;
651651
}

‎net/core/net-sysfs.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,10 +987,10 @@ static ssize_t store_xps_map(struct netdev_queue *queue,
987987
}
988988

989989
if (nonempty)
990-
rcu_assign_pointer(dev->xps_maps, new_dev_maps);
990+
RCU_INIT_POINTER(dev->xps_maps, new_dev_maps);
991991
else {
992992
kfree(new_dev_maps);
993-
rcu_assign_pointer(dev->xps_maps, NULL);
993+
RCU_INIT_POINTER(dev->xps_maps, NULL);
994994
}
995995

996996
if (dev_maps)

0 commit comments

Comments
 (0)