From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> This adds a lock guard for taking an RW semaphore for reading in nested context. It takes the nesting depth as a second argument. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> --- include/linux/rwsem.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index 9c29689ff505..298f5e60d30c 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h @@ -258,4 +258,10 @@ extern void up_read_non_owner(struct rw_semaphore *sem); # define up_read_non_owner(sem) up_read(sem) #endif +DEFINE_LOCK_GUARD_ARGS(rwsem_read_nested, + struct rw_semaphore *, + down_read_nested(_T, subclass), + up_read(_T), + int subclass); + #endif /* _LINUX_RWSEM_H */ -- 2.40.1