diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2012-05-16 18:51:08 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2012-07-02 15:34:23 -0400 |
commit | e9023c4061054cbf59c5288068118a4d0b152f01 (patch) | |
tree | 0bd37bdc925686170b4329eca61962f1df4d3687 /include/linux/rcupdate.h | |
parent | e5c1f444d28b1a9eaf9c3927041db0414f684ef4 (diff) |
rcu: Remove return value from rcu_assign_pointer()
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>
Diffstat (limited to 'include/linux/rcupdate.h')
-rw-r--r-- | include/linux/rcupdate.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index abf44d89c6ce..fb8e6db511d7 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -513,10 +513,10 @@ static inline void rcu_preempt_sleep_check(void) | |||
513 | (_________p1); \ | 513 | (_________p1); \ |
514 | }) | 514 | }) |
515 | #define __rcu_assign_pointer(p, v, space) \ | 515 | #define __rcu_assign_pointer(p, v, space) \ |
516 | ({ \ | 516 | do { \ |
517 | smp_wmb(); \ | 517 | smp_wmb(); \ |
518 | (p) = (typeof(*v) __force space *)(v); \ | 518 | (p) = (typeof(*v) __force space *)(v); \ |
519 | }) | 519 | } while (0) |
520 | 520 | ||
521 | 521 | ||
522 | /** | 522 | /** |
@@ -851,7 +851,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void) | |||
851 | * | 851 | * |
852 | * Assigns the specified value to the specified RCU-protected | 852 | * Assigns the specified value to the specified RCU-protected |
853 | * pointer, ensuring that any concurrent RCU readers will see | 853 | * pointer, ensuring that any concurrent RCU readers will see |
854 | * any prior initialization. Returns the value assigned. | 854 | * any prior initialization. |
855 | * | 855 | * |
856 | * Inserts memory barriers on architectures that require them | 856 | * Inserts memory barriers on architectures that require them |
857 | * (which is most of them), and also prevents the compiler from | 857 | * (which is most of them), and also prevents the compiler from |