Backport of sparse macro __must_hold(), introduced in linux kernel
commit
8529091e:
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.
Change-Id: Ic77304a5f78f1681cfc48a728a12759366bb2cb8
Signed-off-by: frank zago <fzago@cray.com>
Reviewed-on: http://review.whamcloud.com/11294
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
+/* Sparse annotations */
+#ifdef __KERNEL__
+# if !defined(__must_hold)
+# ifdef __CHECKER__
+# define __must_hold(x) __attribute__((context(x, 1, 1)))
+# else /* __CHECKER__ */
+# define __must_hold(x)
+# endif /* !__CHECKER__ */
+# endif /* !__must_hold */
+#endif /* __KERNEL__ */
+
/*
* Lustre Error Checksum: calculates checksum
* of Hex number by XORing each bit.
/*
* Lustre Error Checksum: calculates checksum
* of Hex number by XORing each bit.