[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240110203215.36396-3-brgl@bgdev.pl>
Date: Wed, 10 Jan 2024 21:32:14 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Linus Walleij <linus.walleij@...aro.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>,
Boqun Feng <boqun.feng@...il.com>
Cc: linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: [PATCH 2/3] locking/rwsem: provide a lock guard for down_read_nested()
From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
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@...aro.org>
---
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
Powered by blists - more mailing lists