rcu: Remove return value from RCU_INIT_POINTER()
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 16 May 2012 22:42:30 +0000 (15:42 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 2 Jul 2012 19:34:23 +0000 (12:34 -0700)
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>
include/linux/rcupdate.h

index ffe24c09e53dae37f79bf18850b69660bd8b6399..abf44d89c6ce37e78a7fabe67a4670307b2fb013 100644 (file)
@@ -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
This page took 0.026472 seconds and 5 git commands to generate.