datapath: Add genl_dereference() and use it.
[sliver-openvswitch.git] / datapath / linux / compat / include / linux / genetlink.h
1 #ifndef __GENETLINK_WRAPPER_H
2 #define __GENETLINK_WRAPPER_H 1
3
4 #include_next <linux/genetlink.h>
5
6 #ifdef CONFIG_PROVE_LOCKING
7 /* No version of the kernel has this function, but our locking scheme depends
8  * on genl_mutex so for clarity we use it where appropriate. */
9 static inline int lockdep_genl_is_held(void)
10 {
11         return 1;
12 }
13 #endif
14
15 /* This is also not upstream yet. */
16 #ifndef genl_dereference
17 #include <linux/rcupdate.h>
18
19 #define genl_dereference(p)                                     \
20         rcu_dereference_protected(p, lockdep_genl_is_held())
21 #endif
22
23 #endif /* linux/genetlink.h wrapper */