compat: backport RCU_INIT_POINTER
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 22 May 2011 10:47:33 +0000 (12:47 +0200)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Mon, 23 May 2011 21:06:08 +0000 (14:06 -0700)
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
include/linux/compat-2.6.37.h

index a83c9c7262145eaf0c2cd2378e3d1d4f7ecbd4b2..e0dd6b43b3e727b4a4e233c71eb3ea4e56a910d2 100644 (file)
@@ -115,6 +115,15 @@ extern void *vzalloc(unsigned long size);
 #define rtnl_dereference(p)                                     \
         rcu_dereference_protected(p, lockdep_rtnl_is_held())
 
+/**
+ * RCU_INIT_POINTER() - initialize an RCU protected pointer
+ *
+ * Initialize an RCU-protected pointer in such a way to avoid RCU-lockdep
+ * splats.
+ */
+#define RCU_INIT_POINTER(p, v) \
+               p = (typeof(*v) __force __rcu *)(v)
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */
 
 #endif /* LINUX_26_37_COMPAT_H */