Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9b3cd7f authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller
Browse files

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: default avatarStephen Hemminger <shemminger@vyatta.com>
Acked-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 76f793e3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -553,7 +553,7 @@ static void garp_release_port(struct net_device *dev)
		if (rtnl_dereference(port->applicants[i]))
			return;
	}
	rcu_assign_pointer(dev->garp_port, NULL);
	RCU_INIT_POINTER(dev->garp_port, NULL);
	kfree_rcu(port, rcu);
}

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

	ASSERT_RTNL();

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

	/* Delete timer and generate a final TRANSMIT_PDU event to flush out
	 * all pending messages before the applicant is gone. */
+2 −2
Original line number Diff line number Diff line
@@ -88,9 +88,9 @@ void stp_proto_unregister(const struct stp_proto *proto)
{
	mutex_lock(&stp_proto_mutex);
	if (is_zero_ether_addr(proto->group_address))
		rcu_assign_pointer(stp_proto, NULL);
		RCU_INIT_POINTER(stp_proto, NULL);
	else
		rcu_assign_pointer(garp_protos[proto->group_address[5] -
		RCU_INIT_POINTER(garp_protos[proto->group_address[5] -
					       GARP_ADDR_MIN], NULL);
	synchronize_rcu();

+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head)
	if (grp->nr_vlans == 0) {
		vlan_gvrp_uninit_applicant(real_dev);

		rcu_assign_pointer(real_dev->vlgrp, NULL);
		RCU_INIT_POINTER(real_dev->vlgrp, NULL);

		/* Free the group, after all cpu's are done. */
		call_rcu(&grp->rcu, vlan_rcu_free);
+2 −2
Original line number Diff line number Diff line
@@ -87,14 +87,14 @@ static int __init ebtable_broute_init(void)
	if (ret < 0)
		return ret;
	/* see br_input.c */
	rcu_assign_pointer(br_should_route_hook,
	RCU_INIT_POINTER(br_should_route_hook,
			   (br_should_route_hook_t *)ebt_broute);
	return 0;
}

static void __exit ebtable_broute_fini(void)
{
	rcu_assign_pointer(br_should_route_hook, NULL);
	RCU_INIT_POINTER(br_should_route_hook, NULL);
	synchronize_net();
	unregister_pernet_subsys(&broute_net_ops);
}
+3 −3
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ struct cflayer *cfmuxl_remove_dnlayer(struct cflayer *layr, u8 phyid)
	int idx = phyid % DN_CACHE_SIZE;

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

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

				idx = layer->id % UP_CACHE_SIZE;
				spin_lock_bh(&muxl->receive_lock);
				rcu_assign_pointer(muxl->up_cache[idx], NULL);
				RCU_INIT_POINTER(muxl->up_cache[idx], NULL);
				list_del_rcu(&layer->node);
				spin_unlock_bh(&muxl->receive_lock);
			}
Loading