Skip to content

Commit

Permalink
rcu: Remove return value from RCU_INIT_POINTER()
Browse files Browse the repository at this point in the history
The return value from RCU_INIT_POINTER() is not used, and using it
would be quite ugly, for example:

	q = RCU_INIT_POINTER(global_p, p);

To prevent this sort of ugliness from appearing, this commit wraps
RCU_INIT_POINTER() in a do-while loop.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Acked-by: David Howells <dhowells@redhat.com>
  • Loading branch information
Paul E. McKenney committed Jul 2, 2012
1 parent d36cc70 commit d1b88eb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/linux/rcupdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,9 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
* the reader-accessible portions of the linked structure.
*/
#define RCU_INIT_POINTER(p, v) \
p = (typeof(*v) __force __rcu *)(v)
do { \
p = (typeof(*v) __force __rcu *)(v); \
} while (0)

/**
* RCU_POINTER_INITIALIZER() - statically initialize an RCU protected pointer
Expand Down

0 comments on commit d1b88eb

Please sign in to comment.