From e26fa029fb2db4c2f3746a3bfe46e9a0eeeb41a7 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 8 Feb 2010 09:36:41 -0500 Subject: [PATCH] standardize rcu_gp_ongoing Signed-off-by: Mathieu Desnoyers --- urcu-qsbr-static.h | 20 ++++++++------------ urcu-static.h | 6 ++---- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/urcu-qsbr-static.h b/urcu-qsbr-static.h index 7cef820..9f3a9b9 100644 --- a/urcu-qsbr-static.h +++ b/urcu-qsbr-static.h @@ -156,24 +156,20 @@ static inline void wake_up_gp(void) } #if (BITS_PER_LONG < 64) -static inline int rcu_gp_ongoing(unsigned long *value) +static inline int rcu_gp_ongoing(unsigned long *ctr) { - unsigned long reader_gp; + unsigned long v; - if (value == NULL) - return 0; - reader_gp = LOAD_SHARED(*value); - return reader_gp && ((reader_gp ^ rcu_gp_ctr) & RCU_GP_CTR); + v = LOAD_SHARED(*ctr); + return v && ((v ^ rcu_gp_ctr) & RCU_GP_CTR); } #else /* !(BITS_PER_LONG < 64) */ -static inline int rcu_gp_ongoing(unsigned long *value) +static inline int rcu_gp_ongoing(unsigned long *ctr) { - unsigned long reader_gp; + unsigned long v; - if (value == NULL) - return 0; - reader_gp = LOAD_SHARED(*value); - return reader_gp && (reader_gp - rcu_gp_ctr > ULONG_MAX / 2); + v = LOAD_SHARED(*ctr); + return v && (v - rcu_gp_ctr > ULONG_MAX / 2); } #endif /* !(BITS_PER_LONG < 64) */ diff --git a/urcu-static.h b/urcu-static.h index 1eeb2e6..504febb 100644 --- a/urcu-static.h +++ b/urcu-static.h @@ -242,17 +242,15 @@ static inline void wake_up_gp(void) } } -static inline int rcu_gp_ongoing(unsigned long *value) +static inline int rcu_gp_ongoing(unsigned long *ctr) { unsigned long v; - if (value == NULL) - return 0; /* * Make sure both tests below are done on the same version of *value * to insure consistency. */ - v = LOAD_SHARED(*value); + v = LOAD_SHARED(*ctr); return (v & RCU_GP_CTR_NEST_MASK) && ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); } -- 2.34.1