提交 e9023c40 编写于 作者: P Paul E. McKenney

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: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reported-by: NJosh Triplett <josh@joshtriplett.org>
Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: NJosh Triplett <josh@joshtriplett.org>
上级 e5c1f444
...@@ -513,10 +513,10 @@ static inline void rcu_preempt_sleep_check(void) ...@@ -513,10 +513,10 @@ static inline void rcu_preempt_sleep_check(void)
(_________p1); \ (_________p1); \
}) })
#define __rcu_assign_pointer(p, v, space) \ #define __rcu_assign_pointer(p, v, space) \
({ \ do { \
smp_wmb(); \ smp_wmb(); \
(p) = (typeof(*v) __force space *)(v); \ (p) = (typeof(*v) __force space *)(v); \
}) } while (0)
/** /**
...@@ -851,7 +851,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void) ...@@ -851,7 +851,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
* *
* Assigns the specified value to the specified RCU-protected * Assigns the specified value to the specified RCU-protected
* pointer, ensuring that any concurrent RCU readers will see * 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 * Inserts memory barriers on architectures that require them
* (which is most of them), and also prevents the compiler from * (which is most of them), and also prevents the compiler from
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册