diff options
| author | Paul E. McKenney <[email protected]> | 2021-04-21 21:30:54 +0000 |
|---|---|---|
| committer | Paul E. McKenney <[email protected]> | 2021-05-13 16:13:23 +0000 |
| commit | 76c8eaafe4f061f3790112842a2fbb297e4bea88 (patch) | |
| tree | 3f6feabd24c2677e9cafd06406183f7ff11abd41 /lib/bitmap.c | |
| parent | rcu: Point to documentation of ordering guarantees (diff) | |
| download | kernel-76c8eaafe4f061f3790112842a2fbb297e4bea88.tar.gz kernel-76c8eaafe4f061f3790112842a2fbb297e4bea88.zip | |
rcu: Create an unrcu_pointer() to remove __rcu from a pointer
The xchg() and cmpxchg() functions are sometimes used to carry out RCU
updates. Unfortunately, this can result in sparse warnings for both
the old-value and new-value arguments, as well as for the return value.
The arguments can be dealt with using RCU_INITIALIZER():
old_p = xchg(&p, RCU_INITIALIZER(new_p));
But a sparse warning still remains due to assigning the __rcu pointer
returned from xchg to the (most likely) non-__rcu pointer old_p.
This commit therefore provides an unrcu_pointer() macro that strips
the __rcu. This macro can be used as follows:
old_p = unrcu_pointer(xchg(&p, RCU_INITIALIZER(new_p)));
Reported-by: Toke Høiland-Jørgensen <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
Diffstat (limited to 'lib/bitmap.c')
0 files changed, 0 insertions, 0 deletions
