linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux/compiler.h: Add __must_hold macro for functions called with a lock held
@ 2012-10-08  2:06 Josh Triplett
  2012-10-09 20:06 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Josh Triplett @ 2012-10-08  2:06 UTC (permalink / raw)
  To: linux-kernel, linux-sparse
  Cc: Ed Cashin, Christopher Li, Andrew Morton, Andi Kleen

linux/compiler.h has macros to denote functions that acquire or release
locks, but not to denote functions called with a lock held that return
with the lock still held.  Add a __must_hold macro to cover that case.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reported-by: Ed Cashin <ecashin@coraid.com>
Tested-by: Ed Cashin <ecashin@coraid.com>
---
 include/linux/compiler.h |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index f430e41..b121554 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -10,6 +10,7 @@
 # define __force	__attribute__((force))
 # define __nocast	__attribute__((nocast))
 # define __iomem	__attribute__((noderef, address_space(2)))
+# define __must_hold(x)	__attribute__((context(x,1,1)))
 # define __acquires(x)	__attribute__((context(x,0,1)))
 # define __releases(x)	__attribute__((context(x,1,0)))
 # define __acquire(x)	__context__(x,1)
@@ -33,6 +34,7 @@ extern void __chk_io_ptr(const volatile void __iomem *);
 # define __chk_user_ptr(x) (void)0
 # define __chk_io_ptr(x) (void)0
 # define __builtin_warning(x, y...) (1)
+# define __must_hold(x)
 # define __acquires(x)
 # define __releases(x)
 # define __acquire(x) (void)0
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-13  9:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-08  2:06 [PATCH] linux/compiler.h: Add __must_hold macro for functions called with a lock held Josh Triplett
2012-10-09 20:06 ` Andrew Morton
2012-10-09 20:35   ` Ed Cashin
2012-10-09 20:36   ` Josh Triplett
2012-10-13  9:41     ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).