Provide a static init Signed-off-by: Peter Zijlstra (Intel) --- include/linux/percpu-rwsem.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/include/linux/percpu-rwsem.h +++ b/include/linux/percpu-rwsem.h @@ -16,6 +16,19 @@ struct percpu_rw_semaphore { struct rw_semaphore rw_sem; }; +#define DEFINE_STATIC_PERCPU_RWSEM(name) \ +static DEFINE_PER_CPU(unsigned int, __percpu_rwsem_refcount_##name); \ +static struct percpu_rw_semaphore name = { \ + .refcount = &__percpu_rwsem_refcount_##name, \ + .state = 0, \ + .rss = __RCU_SYNC_INITIALIZER(name.rss, RCU_SCHED_SYNC), \ + .writer = __WAIT_QUEUE_HEAD_INITIALIZER(name.writer), \ + .rw_sem = __RWSEM_INITIALIZER(name.rw_sem), \ +} + +#define lockdep_assert_held_percpu_rwsem(sem) \ + lockdep_assert_held(&(sem)->rw_sem) + extern void __percpu_down_read(struct percpu_rw_semaphore *); extern bool __percpu_down_read_trylock(struct percpu_rw_semaphore *); extern void __percpu_up_read(struct percpu_rw_semaphore *); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/