[RFC 2/3] rcu: allow functions to declare they need RCU locking
From: Johannes Berg
Date: Thu Apr 10 2008 - 10:42:29 EST
Often enough, subsystems have a lookup function that goes from some
sort of key to an RCU-protected structure. They can then declare the
function as such:
struct mystruct *get_mystruct(...) __requires_rcu;
and sparse will automatically be able to check that the function is
invoked under rcu_read_lock().
Not-yet-signed-off-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
---
include/linux/rcupdate.h | 4 ++++
1 file changed, 4 insertions(+)
--- everything.orig/include/linux/rcupdate.h 2008-04-10 15:36:18.000000000 +0200
+++ everything/include/linux/rcupdate.h 2008-04-10 15:36:43.000000000 +0200
@@ -65,6 +65,10 @@ struct rcu_head {
(ptr)->next = NULL; (ptr)->func = NULL; \
} while (0)
+
+#define __requires_rcu __requires(RCU)
+#define __macro_requires_rcu __macro_requires(RCU)
+
/**
* rcu_read_lock - mark the beginning of an RCU read-side critical section.
*
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/