From 7dff59efbb0e8b0f81c95fd40379c0d0c757c808 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Wed, 15 Sep 2010 11:07:15 +0000 Subject: net: add rtnl_dereference() We sometime want to dereference an rcu protected pointer while holding RTNL. Use a macro to hide all lockdep details. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller --- include/linux/rtnetlink.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 263690d991a..68c436bddc8 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -760,6 +760,15 @@ extern int lockdep_rtnl_is_held(void); rcu_dereference_check(p, rcu_read_lock_held() || \ lockdep_rtnl_is_held()) +/** + * rtnl_dereference - rcu_dereference with debug checking + * @p: The pointer to read, prior to dereferencing + * + * Do an rcu_dereference(p), but check caller holds RTNL + */ +#define rtnl_dereference(p) \ + rcu_dereference_check(p, lockdep_rtnl_is_held()) + extern void rtnetlink_init(void); extern void __rtnl_unlock(void); -- cgit v1.2.3-18-g5258