Skip to content

Commit

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

	q = rcu_assign_pointer(global_p, p);

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

Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reported-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
  • Loading branch information
Paul E. McKenney committed Jul 2, 2012
1 parent e5c1f44 commit e9023c4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/linux/rcupdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,10 +513,10 @@ static inline void rcu_preempt_sleep_check(void)
(_________p1); \
})
#define __rcu_assign_pointer(p, v, space) \
({ \
do { \
smp_wmb(); \
(p) = (typeof(*v) __force space *)(v); \
})
} while (0)


/**
Expand Down Expand Up @@ -851,7 +851,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
*
* Assigns the specified value to the specified RCU-protected
* pointer, ensuring that any concurrent RCU readers will see
* any prior initialization. Returns the value assigned.
* any prior initialization.
*
* Inserts memory barriers on architectures that require them
* (which is most of them), and also prevents the compiler from
Expand Down

0 comments on commit e9023c4

Please sign in to comment.